From 1e9fec2a49b305ae2ba9bfa4631e8bacbad995cb Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 22 Nov 2007 10:18:30 +0000 Subject: [PATCH] - Fixed weights array, which was broken with: http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.80&r2=1.81 --- ext/standard/dns.c | 3 +-- ext/standard/tests/network/getmxrr.phpt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 ext/standard/tests/network/getmxrr.phpt diff --git a/ext/standard/dns.c b/ext/standard/dns.c index 269e03c1fc..cf80fb4897 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -836,7 +836,6 @@ PHP_FUNCTION(dns_get_mx) char *hostname; int hostname_len; zval *mx_list, *weight_list = NULL; - int need_weight = 0; int count, qdc; u_short type, weight; u_char ans[MAXPACKET]; @@ -891,7 +890,7 @@ PHP_FUNCTION(dns_get_mx) } cp += i; add_next_index_rt_string(mx_list, buf, ZSTR_DUPLICATE); - if (need_weight) { + if (weight_list) { add_next_index_long(weight_list, weight); } } diff --git a/ext/standard/tests/network/getmxrr.phpt b/ext/standard/tests/network/getmxrr.phpt new file mode 100644 index 0000000000..531001b553 --- /dev/null +++ b/ext/standard/tests/network/getmxrr.phpt @@ -0,0 +1,16 @@ +--TEST-- +dns_check_record() segfault with empty host +--FILE-- + +--EXPECT-- +Hosts: 2, weights: 2 +Hosts: 1, weights: 1 -- 2.50.1