From: Willem Toorop Date: Fri, 19 Apr 2013 21:53:19 +0000 (+0000) Subject: Splint, put end of string at the end (and not end+1) and unbound-1.4.20 regression... X-Git-Tag: release-1.6.17rc1~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5395d29ac0d31a020863a12c82b43e9b72c52e54;p=thirdparty%2Fldns.git Splint, put end of string at the end (and not end+1) and unbound-1.4.20 regression test --- diff --git a/test/32-unbound-1.4.18-regression.tpkg b/test/32-unbound-1.4.18-regression.tpkg deleted file mode 100644 index 3c0818af..00000000 Binary files a/test/32-unbound-1.4.18-regression.tpkg and /dev/null differ diff --git a/test/32-unbound-1.4.20-regression.tpkg b/test/32-unbound-1.4.20-regression.tpkg new file mode 100644 index 00000000..b5639934 Binary files /dev/null and b/test/32-unbound-1.4.20-regression.tpkg differ diff --git a/util.c b/util.c index 435cc344..33060d96 100644 --- a/util.c +++ b/util.c @@ -506,7 +506,7 @@ ldns_b32_ntop_base(const uint8_t* src, size_t src_sz, return -1; /* We know the size; terminate the string */ - dst[ret_sz + 1] = '\0'; + dst[ret_sz] = '\0'; /* First process all chunks of five */ while (src_sz >= 5) { @@ -575,7 +575,7 @@ ldns_b32_ntop_base(const uint8_t* src, size_t src_sz, case 4: dst[7] = '='; } } - return ret_sz; + return (int)ret_sz; } int @@ -634,20 +634,20 @@ ldns_b32_pton_base(const char* src, size_t src_sz, else if (extended_hex) if (ch >= '0' && ch <= '9') - buf[i] = ch - '0'; + buf[i] = (uint8_t)ch - '0'; else if (ch >= 'a' && ch <= 'v') - buf[i] = ch - 'a' + 10; + buf[i] = (uint8_t)ch - 'a' + 10; else if (ch >= 'A' && ch <= 'V') - buf[i] = ch - 'A' + 10; + buf[i] = (uint8_t)ch - 'A' + 10; else return -1; else if (ch >= 'a' && ch <= 'z') - buf[i] = ch - 'a'; + buf[i] = (uint8_t)ch - 'a'; else if (ch >= 'A' && ch <= 'Z') - buf[i] = ch - 'A'; + buf[i] = (uint8_t)ch - 'A'; else if (ch >= '2' && ch <= '7') - buf[i] = ch - '2' + 26; + buf[i] = (uint8_t)ch - '2' + 26; else return -1; }