]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
Also anticipate the more data at the end of an ilnp64 case
authorWillem Toorop <willem@NLnetLabs.nl>
Wed, 12 Dec 2012 14:00:54 +0000 (14:00 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Wed, 12 Dec 2012 14:00:54 +0000 (14:00 +0000)
str2host.c

index 399974b15d2cc61ee5d8ddf6c2a446667845d29a..a60030e3e34369fab01163323416512ec16731e3 100644 (file)
@@ -1323,9 +1323,12 @@ ldns_str2rdf_ilnp64(ldns_rdf **rd, const char *str)
 {
        unsigned int a, b, c, d;
        uint16_t shorts[4];
+       int l;
 
-       if (sscanf(str, "%4x:%4x:%4x:%4x", &a, &b, &c, &d) != 4 ||
-                       strpbrk(str, "+-") /* no signs */) {
+       if (sscanf(str, "%4x:%4x:%4x:%4x%n", &a, &b, &c, &d, &l) != 4 ||
+                       l != (int)strlen(str) || /* more data to read */
+                       strpbrk(str, "+-")       /* signed hexes */
+                       ) {
                return LDNS_STATUS_INVALID_ILNP64;
        } else {
                shorts[0] = htons(a);