From: Matthijs Mekking Date: Wed, 11 Jan 2012 15:59:22 +0000 (+0000) Subject: \DDD can only be [0...255] X-Git-Tag: release-1.6.13rc1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d1f9553c7ff28947a738249b4304d199e86b332;p=thirdparty%2Fldns.git \DDD can only be [0...255] --- diff --git a/Changelog b/Changelog index f28486c8..88efcae6 100644 --- 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) diff --git a/str2host.c b/str2host.c index 4ec9d379..95fbe7a5 100644 --- a/str2host.c +++ b/str2host.c @@ -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)) {