0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4255: theoretical computation overflow

Problem:    Theoretical computation overflow.
Solution:   Perform multiplication in a wider type. (closes #9657)
This commit is contained in:
=?UTF-8?q?Dundar=20G=C3=B6c?=
2022-01-29 15:19:23 +00:00
committed by Bram Moolenaar
parent f12b7815f6
commit d5cec1f1f0
11 changed files with 28 additions and 23 deletions

View File

@@ -4738,7 +4738,7 @@ replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL)
++i;
len = (int)STRLEN(p);
new_cmdline = alloc(STRLEN(program) + i * (len - 2) + 1);
new_cmdline = alloc(STRLEN(program) + (size_t)i * (len - 2) + 1);
if (new_cmdline == NULL)
return NULL; // out of memory
ptr = new_cmdline;