patch 8.2.4255: theoretical computation overflow
Problem: Theoretical computation overflow.
Solution: Perform multiplication in a wider type. (closes #9657)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index aa91539..c55b34d 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -4738,7 +4738,7 @@
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;