php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #78008
Patch 78008-dns_check_record-74.patch revision 2020-07-14 01:58 UTC by apostnikov at gmail dot com
Patch dns_check_record_patch_light revision 2019-05-13 16:13 UTC by a dot suharevs at dyninno dot lv
Patch dns_check_record_patch revision 2019-05-13 14:58 UTC by a dot suharevs at dyninno dot lv

Patch dns_check_record_patch_light for *Network Functions Bug #78008

Patch version 2019-05-13 16:13 UTC

Return to Bug #78008 | Download this patch
This patch renders other patches obsolete

Obsolete patches:

Patch Revisions:

Developer: a.suharevs@dyninno.lv

diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index 3f34ba67ee..f112e46ae1 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -352,7 +352,7 @@ PHP_FUNCTION(dns_check_record)
 #ifndef MAXPACKET
 #define MAXPACKET  8192 /* max packet size used internally by BIND */
 #endif
-	u_char ans[MAXPACKET];
+	querybuf answer;
 	char *hostname, *rectype = NULL;
 	size_t hostname_len, rectype_len = 0;
 	int type = DNS_T_MX, i;
@@ -411,12 +411,24 @@ PHP_FUNCTION(dns_check_record)
 #endif
 
 	RETVAL_TRUE;
-	i = php_dns_search(handle, hostname, C_IN, type, ans, sizeof(ans));
+	i = php_dns_search(handle, hostname, C_IN, type, answer.qb2, sizeof answer);
 
 	if (i < 0) {
 		RETVAL_FALSE;
 	}
 
+#if defined(HAVE_RES_SEARCH)
+	HEADER *hp;
+	int an;
+
+	hp = (HEADER *)&answer;
+	an = ntohs(hp->ancount);
+
+	if (an == 0) {
+		RETVAL_FALSE;
+	}
+#endif
+
 	php_dns_free_handle(handle);
 }
 /* }}} */
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC