Skip to content

Commit 774cd96

Browse files
committed
No need to null-terminate buffer in php_mb_chr
`mbfl_buffer_converter_feed_result` will not overrun the specified length.
1 parent abf83e5 commit 774cd96

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

ext/mbstring/mbstring.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4050,7 +4050,7 @@ static inline zend_string *php_mb_chr(zend_long cp, zend_string *enc_name, uint3
40504050
const mbfl_encoding *enc;
40514051
enum mbfl_no_encoding no_enc;
40524052
zend_string *ret;
4053-
char buf[5];
4053+
char buf[4];
40544054

40554055
enc = php_mb_get_encoding(enc_name, enc_name_arg_num);
40564056
if (!enc) {
@@ -4101,7 +4101,6 @@ static inline zend_string *php_mb_chr(zend_long cp, zend_string *enc_name, uint3
41014101
buf[1] = (cp >> 16) & 0xff;
41024102
buf[2] = (cp >> 8) & 0xff;
41034103
buf[3] = cp & 0xff;
4104-
buf[4] = 0;
41054104

41064105
size_t ret_len;
41074106
long orig_illegalchars = MBSTRG(illegalchars);

0 commit comments

Comments
 (0)