summaryrefslogtreecommitdiff
path: root/ext/standard/dns.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2008-11-03 11:35:11 +0000
committerFelipe Pena <felipe@php.net>2008-11-03 11:35:11 +0000
commit7e25733927c8b1de4ba19550eca2a7a000dcfaea (patch)
tree50779dc29a5dda09b10148c578861d2151ce8141 /ext/standard/dns.c
parente47e0828f614dc0c4c6e03fa90baf7af21d424b0 (diff)
downloadphp-git-7e25733927c8b1de4ba19550eca2a7a000dcfaea.tar.gz
- MFH: Fixed bug #42855 (dns_get_record() doesn't return all text from TXT record)
patch by: misc at e2007 dot cynergi dot com
Diffstat (limited to 'ext/standard/dns.c')
-rw-r--r--ext/standard/dns.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 39412adc86..f0276b6081 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -446,13 +446,22 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int
cp += n;
break;
case DNS_T_TXT:
- add_assoc_string(*subarray, "type", "TXT", 1);
- n = cp[0];
- tp = emalloc(n + 1);
- memcpy(tp, cp + 1, n);
- tp[n] = '\0';
- cp += dlen;
- add_assoc_stringl(*subarray, "txt", (char*)tp, n, 0);
+ {
+ int ll = 0;
+
+ add_assoc_string(*subarray, "type", "TXT", 1);
+ 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_assoc_stringl(*subarray, "txt", tp, dlen, 0);
+ }
break;
case DNS_T_SOA:
add_assoc_string(*subarray, "type", "SOA", 1);