Mercurial > vim
comparison src/ex_docmd.c @ 27453:c7f614c9ceb3 v8.2.4255
patch 8.2.4255: theoretical computation overflow
Commit: https://github.com/vim/vim/commit/d5cec1f1f055316c353cfa15ad8d5eb0952d50a0
Author: =?UTF-8?q?Dundar=20G=C3=B6c?= <gocdundar@gmail.com>
Date: Sat Jan 29 15:19:23 2022 +0000
patch 8.2.4255: theoretical computation overflow
Problem: Theoretical computation overflow.
Solution: Perform multiplication in a wider type. (closes https://github.com/vim/vim/issues/9657)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 29 Jan 2022 16:30:03 +0100 |
parents | 41e0dcf38521 |
children | df414fc12eed |
comparison
equal
deleted
inserted
replaced
27452:81af1f0ff8ce | 27453:c7f614c9ceb3 |
---|---|
4736 // replace $* by given arguments | 4736 // replace $* by given arguments |
4737 i = 1; | 4737 i = 1; |
4738 while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL) | 4738 while ((pos = (char_u *)strstr((char *)pos + 2, "$*")) != NULL) |
4739 ++i; | 4739 ++i; |
4740 len = (int)STRLEN(p); | 4740 len = (int)STRLEN(p); |
4741 new_cmdline = alloc(STRLEN(program) + i * (len - 2) + 1); | 4741 new_cmdline = alloc(STRLEN(program) + (size_t)i * (len - 2) + 1); |
4742 if (new_cmdline == NULL) | 4742 if (new_cmdline == NULL) |
4743 return NULL; // out of memory | 4743 return NULL; // out of memory |
4744 ptr = new_cmdline; | 4744 ptr = new_cmdline; |
4745 while ((pos = (char_u *)strstr((char *)program, "$*")) != NULL) | 4745 while ((pos = (char_u *)strstr((char *)program, "$*")) != NULL) |
4746 { | 4746 { |