mirror of
https://github.com/php/php-src.git
synced 2024-09-23 19:07:26 +00:00
MFB: Fixed bug #41347 (checkdnsrr() segfaults on empty hostname).
This commit is contained in:
parent
5955f884b9
commit
ecab534aa8
@ -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;
|
||||
|
15
ext/standard/tests/network/bug41347.phpt
Normal file
15
ext/standard/tests/network/bug41347.phpt
Normal 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)
|
Loading…
Reference in New Issue
Block a user