Skip to content

Commit efdbb47

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Fix uninitialized variable accesses in sockets/conversions
2 parents 2f309de + 8a1cbdd commit efdbb47

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ext/sockets/conversions.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,10 @@ static void from_zval_write_sockaddr_aux(const zval *container,
728728
zend_llist_add_element(&ctx->keys, &node);
729729
from_zval_write_int(elem, (char*)&family, ctx);
730730
zend_llist_remove_tail(&ctx->keys);
731+
732+
if (UNEXPECTED(ctx->err.has_error)) {
733+
return;
734+
}
731735
} else {
732736
family = ctx->sock->type;
733737
}
@@ -1123,7 +1127,10 @@ static void from_zval_write_controllen(const zval *elem, char *msghdr_c, ser_con
11231127
* this least common denominator
11241128
*/
11251129
from_zval_write_uint32(elem, (char*)&len, ctx);
1126-
if (!ctx->err.has_error && len == 0) {
1130+
if (ctx->err.has_error) {
1131+
return;
1132+
}
1133+
if (len == 0) {
11271134
do_from_zval_err(ctx, "controllen cannot be 0");
11281135
return;
11291136
}

0 commit comments

Comments
 (0)