]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
bugfix #1257: Free after reallocing to 0 size
authorWillem Toorop <willem@nlnetlabs.nl>
Wed, 26 Apr 2017 22:25:20 +0000 (00:25 +0200)
committerWillem Toorop <willem@nlnetlabs.nl>
Wed, 26 Apr 2017 22:25:20 +0000 (00:25 +0200)
Thanks Stephan Zeisberg

Changelog
str2host.c

index 77861485ecf19871a434b8e24063f44e02f753ac..d7aa7116c6f97f638cd44ea6f01efa05de9c38b9 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,6 @@
 1.7.1  ????-??-??
+       * bugfix #1257: Free after reallocing to 0 size
+         Thanks Stephan Zeisberg
        * bugfix #1256: Check parse limit before t increment
          Thanks Stephan Zeisberg
        * bugfix #1245: Only one signature per RRset needs to be valid with
index b274b17a2bf9a44b8aa1044c545118f8dcc27af8..f2a317beaf180b0910343514d74bfe5739f8396d 100644 (file)
@@ -1525,8 +1525,10 @@ ldns_str2rdf_long_str(ldns_rdf **rd, const char *str)
        if (! str) {
                return LDNS_STATUS_SYNTAX_BAD_ESCAPE;
        }
-       length = (size_t)(dp - data);
-
+       if (!(length = (size_t)(dp - data))) {
+               LDNS_FREE(data);
+               return LDNS_STATUS_SYNTAX_EMPTY;
+       }
        /* Lose the overmeasure */
        data = LDNS_XREALLOC(dp = data, uint8_t, length);
        if (! data) {