MFB: Fixed bug #41347 (checkdnsrr() segfaults on empty hostname).

This commit is contained in:
Scott MacVicar 2007-05-14 14:38:29 +00:00
parent 5955f884b9
commit ecab534aa8
2 changed files with 21 additions and 0 deletions

View File

@ -263,6 +263,12 @@ PHP_FUNCTION(dns_check_record)
return;
}
if (hostname_len == 0)
{
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host cannot be empty");
RETURN_FALSE;
}
if (rectype) {
if (!strcasecmp("A", rectype)) type = T_A;
else if (!strcasecmp("NS", rectype)) type = DNS_T_NS;

View File

@ -0,0 +1,15 @@
--TEST--
dns_check_record() segfault with empty host
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('No windows support');
}
?>
--FILE--
<?php
var_dump(dns_check_record(''));
?>
--EXPECTF--
Warning: dns_check_record(): Host cannot be empty in %s on line %d
bool(false)