com php-src: Fix bug #64458 (dns_get_record result wi th string of length -1): NEWS ext/standard/dn s.c

From: Date: Wed, 24 Apr 2013 04:43:35 +0000
Subject: com php-src: Fix bug #64458 (dns_get_record result wi th string of length -1): NEWS ext/standard/dn s.c
Groups: php.cvs 
Request: Send a blank email to [email protected] to get a copy of this message
Commit:    18fdab5a09b64252a9a61ad6d1b2eff4a257b8f2
Author:    Stanislav Malyshev <[email protected]>         Tue, 23 Apr 2013 21:42:15 -0700
Parents:   4cf0647399b7f79fa1d74bba9d528bc74b78ba10
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:       http://git.php.net/?p=php-src.git;a=commitdiff;h=18fdab5a09b64252a9a61ad6d1b2eff4a257b8f2

Log:
Fix bug #64458 (dns_get_record result with string of length -1)

Bugs:
https://bugs.php.net/64458

Changed paths:
  M  NEWS
  M  ext/standard/dns.c


Diff:
diff --git a/NEWS b/NEWS
index 0876c1e..af4957e 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 7bf7cca..8e24a81 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;



Thread (1 message)

  • Stanislav Malyshev
« previous php.cvs (#71992) next »