felipe          Mon Nov  3 11:33:32 2008 UTC

  Modified files:              
    /php-src/ext/standard       dns.c 
  Log:
  - Fixed bug #42855 (dns_get_record() doesn't return all text from TXT record)
    patch by: misc at e2007 dot cynergi dot com
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.94&r2=1.95&diff_format=u
Index: php-src/ext/standard/dns.c
diff -u php-src/ext/standard/dns.c:1.94 php-src/ext/standard/dns.c:1.95
--- php-src/ext/standard/dns.c:1.94     Thu Aug 21 23:37:40 2008
+++ php-src/ext/standard/dns.c  Mon Nov  3 11:33:32 2008
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dns.c,v 1.94 2008/08/21 23:37:40 pajoye Exp $ */
+/* $Id: dns.c,v 1.95 2008/11/03 11:33:32 felipe Exp $ */
 
 /* {{{ includes */
 #include "php.h"
@@ -446,13 +446,22 @@
                        cp += n;
                        break;
                case DNS_T_TXT:
-                       add_ascii_assoc_rt_string(*subarray, "type", "TXT", 
ZSTR_DUPLICATE);
-                       n = cp[0];
-                       tp = emalloc(n + 1);
-                       memcpy(tp, cp + 1, n);
-                       tp[n] = '\0';
-                       cp += dlen;
-                       add_ascii_assoc_rt_stringl(*subarray, "txt", (char*)tp, 
n, ZSTR_AUTOFREE);
+                       {
+                               int ll = 0;
+
+                               add_ascii_assoc_rt_string(*subarray, "type", 
"TXT", ZSTR_DUPLICATE);
+                               tp = emalloc(dlen + 1);
+                               
+                               while (ll < dlen) {
+                                       n = cp[ll];
+                                       memcpy(tp + ll , cp + ll + 1, n);
+                                       ll = ll + n + 1;
+                               }
+                               tp[dlen] = '\0';
+                               cp += dlen;
+
+                               add_ascii_assoc_rt_stringl(*subarray, "txt", 
tp, dlen, ZSTR_AUTOFREE);
+                       }
                        break;
                case DNS_T_SOA:
                        add_ascii_assoc_rt_string(*subarray, "type", "SOA", 
ZSTR_DUPLICATE);



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

Reply via email to