Add assertion to mb_utf7imap_to_wchar to catch buffer overrun

I don't believe such a buffer overrun will ever occur, but just in
case the code is changed in the future, it will be good to have an
assertion here to help catch bugs. (A similar assertion is already
used in the UTF-7 version of this function.)
This commit is contained in:
Alex Dowad 2023-07-16 14:44:40 +02:00
parent 3944bb01eb
commit a57fdea149

View file

@ -616,6 +616,7 @@ static size_t mb_utf7imap_to_wchar(unsigned char **in, size_t *in_len, uint32_t
if (p == e && base64) {
/* UTF7-IMAP doesn't allow strings to end in Base64 mode
* One space in output buffer was reserved just for this */
ZEND_ASSERT(out < limit);
*out++ = MBFL_BAD_INPUT;
}