0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.1144: reading beyond text

Problem:    Reading beyond text.
Solution:   Add strlen_maxlen() and use it.
This commit is contained in:
Bram Moolenaar
2023-01-04 15:56:51 +00:00
parent 7b17eb4b06
commit c32949b077
5 changed files with 30 additions and 2 deletions

View File

@@ -3055,7 +3055,8 @@ msg_puts_printf(char_u *str, int maxlen)
{
char_u *tofree = NULL;
if (maxlen > 0 && STRLEN(p) > (size_t)maxlen)
if (maxlen > 0 && vim_strlen_maxlen((char *)p, (size_t)maxlen)
>= (size_t)maxlen)
{
tofree = vim_strnsave(p, (size_t)maxlen);
p = tofree;