Skip to content

Commit 810ac6d

Browse files
Merge branch 'PHP-8.6'
* PHP-8.6: ext/iconv: add a hardening assertion that `char_cnt` doesn't underflow (#23873)
2 parents c8a8c24 + dc1145e commit 810ac6d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎ext/iconv/iconv.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,12 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
11021102
const unsigned char *p;
11031103
size_t nbytes_required;
11041104

1105+
/* Some agents get confused about what char_cnt is; it will
1106+
* be at least 4 at this point; if caller messed up and gave
1107+
* too short of a max_line_len that was already caught above
1108+
* and handled with PHP_ICONV_ERR_TOO_BIG. */
1109+
ZEND_ASSERT(char_cnt >= 4);
1110+
11051111
smart_str_appendc(pretval, 'Q');
11061112
char_cnt--;
11071113
smart_str_appendc(pretval, '?');

0 commit comments

Comments
 (0)