[php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
| From: | David Carlier | Date: | Tue, 10 Nov 2026 21:14:05 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143555@lists.php.net to get a copy of this message | ||
Author: David Carlier (devnexen)
Date: 2026-11-10T21:11:48Z
Commit: https://github.com/php/php-src/commit/d54a5ddb7facf4866979c8b1839aa3a5fdfa610d
Raw diff: https://github.com/php/php-src/commit/d54a5ddb7facf4866979c8b1839aa3a5fdfa610d.diff
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
ext/standard/dns.c: drop partially built records in php_parserr()
Changed paths:
M ext/standard/dns.c
Diff:
diff --git a/ext/standard/dns.c b/ext/standard/dns.c
index b3fcc1d236af..c9983893b856 100644
--- a/ext/standard/dns.c
+++ b/ext/standard/dns.c
@@ -439,7 +439,7 @@ PHP_FUNCTION(dns_check_record)
#define CHECKCP(n) do { \
if (cp + n > end) { \
- return NULL; \
+ goto fail; \
} \
} while (0)
@@ -526,7 +526,7 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int typ
}
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
if (n < 0) {
- return NULL;
+ goto fail;
}
cp += n;
add_assoc_string(subarray, "target", name);
@@ -563,7 +563,7 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int typ
add_assoc_stringl(subarray, "tag", (char*)cp, n);
cp += n;
if ( (size_t) dlen < ((size_t)n) + 2 ) {
- return NULL;
+ goto fail;
}
n = dlen - n - 2;
CHECKCP(n);
@@ -606,13 +606,13 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int
typ
add_assoc_string(subarray, "type", "SOA");
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) -2);
if (n < 0) {
- return NULL;
+ goto fail;
}
cp += n;
add_assoc_string(subarray, "mname", name);
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) -2);
if (n < 0) {
- return NULL;
+ goto fail;
}
cp += n;
add_assoc_string(subarray, "rname", name);
@@ -733,7 +733,7 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int typ
if (cp < p + dlen) {
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
if (n < 0) {
- return NULL;
+ goto fail;
}
cp += n;
add_assoc_string(subarray, "chain", name);
@@ -750,7 +750,7 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int typ
add_assoc_long(subarray, "port", n);
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
if (n < 0) {
- return NULL;
+ goto fail;
}
cp += n;
add_assoc_string(subarray, "target", name);
@@ -786,7 +786,7 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int typ
n = dn_expand(answer->qb2, end, cp, name, (sizeof name) - 2);
if (n < 0) {
- return NULL;
+ goto fail;
}
cp += n;
add_assoc_string(subarray, "replacement", name);
@@ -799,6 +799,12 @@ static uint8_t *php_parserr(uint8_t *cp, uint8_t *end, querybuf *answer, int
typ
}
return cp;
+
+fail:
+ /* Drop the partially built record, so that the caller does not publish it. */
+ zval_ptr_dtor(subarray);
+ ZVAL_UNDEF(subarray);
+ return NULL;
}
/* }}} */