]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
\DDD can only be [0...255]
authorMatthijs Mekking <matje@NLnetLabs.nl>
Wed, 11 Jan 2012 15:59:22 +0000 (15:59 +0000)
committerMatthijs Mekking <matje@NLnetLabs.nl>
Wed, 11 Jan 2012 15:59:22 +0000 (15:59 +0000)
Changelog
str2host.c

index f28486c8dcbe320164e61f13baa2a632df68d269..88efcae6bd0af102cd0c1d7f6388f50baf53b829 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,7 @@
 1.6.13
+       * Fix reading \DDD: Error on values that are outside range (>255).
 
-1.6.12 2012-01-11
+1.6.12
        * bugfix #413: Fix manpage source for srcdir != builddir
        * Canonicalize the signers name rdata field in RRSIGs when signing
        * Ignore minor version of Private-key-format (so v1.3 may be used)
index 4ec9d379bc7760272accf6c80f217b6c04cf6c28..95fbe7a59dd9addc437db8e000b26668fba98da9 100644 (file)
@@ -259,17 +259,21 @@ ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr)
  */
 static int
 parse_escape(uint8_t *s, uint8_t *q) {
-       uint8_t val;
+       uint16_t val;
        if (strlen((char *)s) > 3 &&
            isdigit((int) s[1]) &&
            isdigit((int) s[2]) &&
            isdigit((int) s[3])) {
                /* cast this so it fits */
-               val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 +
+               val = (uint16_t) ldns_hexdigit_to_int((char) s[1]) * 100 +
                                ldns_hexdigit_to_int((char) s[2]) * 10 +
                                ldns_hexdigit_to_int((char) s[3]);
-               *q = val;
-               return 3;
+               if (val > 255) {
+                       /* outside range */
+                       return 0;
+               }
+               *q = (uint8_t) val;
+                return 3;
        } else {
                s++;
                if (*s == '\0' || isdigit((int) *s)) {