summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Toorop <willem@nlnetlabs.nl>2017-04-27 00:25:20 (CEST)
committerWillem Toorop <willem@nlnetlabs.nl>2017-04-27 00:25:20 (CEST)
commit3bdeed02505c9bbacb3b64a97ddcb1de967153b7 (patch)
tree631d75a7a445f66ec7295744b1fb45e154971c67
parentc8391790c96d4c8a2c10f9ab1460fda83b509fc2 (diff)
downloadldns-3bdeed02.tar.gz
bugfix #1257: Free after reallocing to 0 sizerefs/keep-around/3bdeed02505c9bbacb3b64a97ddcb1de967153b7
Thanks Stephan Zeisberg
-rw-r--r--Changelog2
-rw-r--r--str2host.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/Changelog b/Changelog
index 7786148..d7aa711 100644
--- 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
diff --git a/str2host.c b/str2host.c
index b274b17..f2a317b 100644
--- a/str2host.c
+++ b/str2host.c
@@ -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) {