From 18fdab5a09b64252a9a61ad6d1b2eff4a257b8f2 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Tue, 23 Apr 2013 21:42:15 -0700 Subject: Fix bug #64458 (dns_get_record result with string of length -1) --- NEWS | 1 + ext/standard/dns.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0876c1e2fe..af4957e365 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ PHP NEWS - Core: . Fixed bug #64578 (debug_backtrace in set_error_handler corrupts zend heap: segfault). (Laruence) + . Fixed bug #64458 (dns_get_record result with string of length -1). (Stas) . Fixed bugs #47675 and #64577 (fd leak on Solaris) - Zip: diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 7bf7ccac85..8e24a817ff 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -514,7 +514,7 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int tp[dlen] = '\0'; cp += dlen; - add_assoc_stringl(*subarray, "txt", tp, dlen - 1, 0); + add_assoc_stringl(*subarray, "txt", tp, (dlen>0)?dlen - 1:0, 0); add_assoc_zval(*subarray, "entries", entries); } break; -- cgit v1.2.1