mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
MFB: Fixed bug #41347 (checkdnsrr() segfaults on empty hostname).
This commit is contained in:
parent
5955f884b9
commit
ecab534aa8
2 changed files with 21 additions and 0 deletions
|
@ -263,6 +263,12 @@ PHP_FUNCTION(dns_check_record)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hostname_len == 0)
|
||||||
|
{
|
||||||
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Host cannot be empty");
|
||||||
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (rectype) {
|
if (rectype) {
|
||||||
if (!strcasecmp("A", rectype)) type = T_A;
|
if (!strcasecmp("A", rectype)) type = T_A;
|
||||||
else if (!strcasecmp("NS", rectype)) type = DNS_T_NS;
|
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…
Add table
Add a link
Reference in a new issue