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:
committed by
Bram Moolenaar
parent
f12b7815f6
commit
d5cec1f1f0
@@ -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;
|
||||
|
Reference in New Issue
Block a user