Skip to content

Commit ecc4bf1

Browse files
committed
Fixed bug #80958
Missing check after zval_try_get_string(). Closes GH-6871.
1 parent 09f5560 commit ecc4bf1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ext/standard/string.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4637,9 +4637,13 @@ static zend_string *try_setlocale_str(zend_long cat, zend_string *loc) {
46374637
}
46384638

46394639
static zend_string *try_setlocale_zval(zend_long cat, zval *loc_zv) {
4640-
zend_string *loc_str = zval_try_get_string(loc_zv);
4640+
zend_string *tmp_loc_str;
4641+
zend_string *loc_str = zval_try_get_tmp_string(loc_zv, &tmp_loc_str);
4642+
if (UNEXPECTED(loc_str == NULL)) {
4643+
return NULL;
4644+
}
46414645
zend_string *result = try_setlocale_str(cat, loc_str);
4642-
zend_string_release_ex(loc_str, 0);
4646+
zend_tmp_string_release(tmp_loc_str);
46434647
return result;
46444648
}
46454649

0 commit comments

Comments
 (0)