X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Futils_dns.c;h=f83fc02c401cdd278d49ade7eea057f6ab4902c8;hb=1b4d95b869063e619bd7aae54cf37c5a1b91fbee;hp=6abfde16fba0f5cd2da6e1da4f98832717f48519;hpb=d6491cfcf52a74498e1becd7ef94fc8e0a5938b9;p=collectd.git diff --git a/src/utils_dns.c b/src/utils_dns.c index 6abfde16..f83fc02c 100644 --- a/src/utils_dns.c +++ b/src/utils_dns.c @@ -305,7 +305,7 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns if (ns <= 0) return 4; /* probably compression loop */ do { - if ((*off) >= sz) + if ((*off) >= ((off_t) sz)) break; c = *(buf + (*off)); if (c > 191) { @@ -317,11 +317,11 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns s = ntohs(s); (*off) += sizeof(s); /* Sanity check */ - if ((*off) >= sz) + if ((*off) >= ((off_t) sz)) return 1; /* message too short */ ptr = s & 0x3FFF; /* Make sure the pointer is inside this message */ - if (ptr >= sz) + if (ptr >= ((off_t) sz)) return 2; /* bad compression ptr */ if (ptr < DNS_MSG_HDR_SZ) return 2; /* bad compression ptr */ @@ -355,7 +355,7 @@ rfc1035NameUnpack(const char *buf, size_t sz, off_t * off, char *name, size_t ns if (no > 0) *(name + no - 1) = '\0'; /* make sure we didn't allow someone to overflow the name buffer */ - assert(no <= ns); + assert(no <= ((off_t) ns)); return 0; }