pollita         Fri Mar 19 16:43:44 2004 EDT

  Modified files:              
    /php-src/ext/standard       dns.c 
  Log:
  Bug Fix #27657: TXT records longer than MAXHOSTNAMELEN cause segfaults.
  
http://cvs.php.net/diff.php/php-src/ext/standard/dns.c?r1=1.66&r2=1.67&ty=u
Index: php-src/ext/standard/dns.c
diff -u php-src/ext/standard/dns.c:1.66 php-src/ext/standard/dns.c:1.67
--- php-src/ext/standard/dns.c:1.66     Thu Jan  8 03:17:31 2004
+++ php-src/ext/standard/dns.c  Fri Mar 19 16:42:29 2004
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dns.c,v 1.66 2004/01/08 08:17:31 andi Exp $ */
+/* $Id: dns.c,v 1.67 2004/03/19 21:42:29 pollita Exp $ */
 
 /* {{{ includes */
 #include "php.h"
@@ -400,12 +400,14 @@
                        break;
                case T_TXT:
                        add_assoc_string(*subarray, "type", "TXT", 1);
-                       n = cp[0]; 
-                       for(i=1; i<=n; i++)
-                               name[i-1] = cp[i];
-                       name[i-1] = '\0';
+                       n = cp[0];
+                       tp = emalloc(n + 1);
+                       for(i=1; i<=n; i++) {
+                               tp[i-1] = cp[i];
+                       }
+                       tp[i-1] = '\0';
                        cp += dlen;
-                       add_assoc_string(*subarray, "txt", name, 1);
+                       add_assoc_stringl(*subarray, "txt", tp, n, 0);
                        break;
                case T_SOA:
                        add_assoc_string(*subarray, "type", "SOA", 1);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to