| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 Patch dns_check_record_patch_light for *Network Functions Bug #78008Patch version 2019-05-13 16:13 UTC Return to Bug #78008 | Download this patchThis 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);
 }
 /* }}} */
         | 
    
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 02:00:01 2025 UTC |