From e40e5bfcd40be2bbdce8a00066709bcf85b8c79c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 3 Apr 2020 17:29:13 +0200 Subject: [PATCH] bad sizeof --- src/include/gnunet_common.h | 2 +- src/util/mq.c | 6 ++++-- src/util/service.c | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 76c2b9352..86d1a9f37 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -1151,7 +1151,7 @@ GNUNET_is_zero_ (const void *a, * @return 0 if a is zero, non-zero otherwise */ #define GNUNET_is_zero(a) \ - GNUNET_is_zero_ (a, sizeof (a)) + GNUNET_is_zero_ (a, sizeof (*a)) /** diff --git a/src/util/mq.c b/src/util/mq.c index 003e0955d..78dc7dba2 100644 --- a/src/util/mq.c +++ b/src/util/mq.c @@ -297,7 +297,8 @@ done: * @param error the error type */ void -GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_Error error) +GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, + enum GNUNET_MQ_Error error) { if (NULL == mq->error_handler) { @@ -306,7 +307,8 @@ GNUNET_MQ_inject_error (struct GNUNET_MQ_Handle *mq, enum GNUNET_MQ_Error error) (int) error); return; } - mq->error_handler (mq->error_handler_cls, error); + mq->error_handler (mq->error_handler_cls, + error); } diff --git a/src/util/service.c b/src/util/service.c index 999a9e017..9dc14eba9 100644 --- a/src/util/service.c +++ b/src/util/service.c @@ -468,7 +468,6 @@ check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, const struct in6_addr *ip) { unsigned int i; - unsigned int j; if (NULL == list) return GNUNET_NO; @@ -476,7 +475,7 @@ check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, NEXT: while (0 != GNUNET_is_zero (&list[i].network)) { - for (j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++) + for (unsigned int j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++) if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) != (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j])) { -- 2.25.1