diff options
author | Sara Golemon <pollita@php.net> | 2014-06-11 13:53:59 -0700 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2014-06-11 13:53:59 -0700 |
commit | b34d7849ed90ced9345f8ea1c59bc8d101c18468 (patch) | |
tree | 957e1c46d6be48a4e0137bc171547e729332136a | |
parent | ec974c439724e8b4151412eaa0caba5aec5e1c49 (diff) | |
parent | e2ef56f760c6425d002454234c45c5e777d85058 (diff) | |
download | php-git-b34d7849ed90ced9345f8ea1c59bc8d101c18468.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Fix potential segfault in dns_get_record()
-rw-r--r-- | ext/standard/dns.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 6a894467ff..214a7dc7e9 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -517,6 +517,10 @@ static u_char *php_parserr(u_char *cp, querybuf *answer, int type_to_fetch, int while (ll < dlen) { n = cp[ll]; + if ((ll + n) >= dlen) { + // Invalid chunk length, truncate + n = dlen - (ll + 1); + } memcpy(tp + ll , cp + ll + 1, n); add_next_index_stringl(entries, cp + ll + 1, n, 1); ll = ll + n + 1; |