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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user