diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-01-08 16:47:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-08 16:47:23 +0100 |
commit | 9386fca597cdb6ecf0da827676dd5b5554b73f69 (patch) | |
tree | 372da7090d03076dd79136bd9ba9c94a6d72be19 /src/nvim/ex_docmd.c | |
parent | e70ea6ea20915865939d5199a18aebf68b67a708 (diff) | |
parent | 3fccdeb326f5633d3c84b98ac1bd0b15b7fd28a5 (diff) | |
download | rneovim-9386fca597cdb6ecf0da827676dd5b5554b73f69.tar.gz rneovim-9386fca597cdb6ecf0da827676dd5b5554b73f69.tar.bz2 rneovim-9386fca597cdb6ecf0da827676dd5b5554b73f69.zip |
Merge pull request #16848 from dundargoc/refactor/prevent-overflow-by-casting
refactor: avoid overflow by explicitly casting operand to a wider type
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 71c34f98ff..3a285cdf90 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -4370,7 +4370,7 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) ++i; } len = (int)STRLEN(p); - new_cmdline = xmalloc(STRLEN(program) + i * (len - 2) + 1); + new_cmdline = xmalloc(STRLEN(program) + (size_t)i * (len - 2) + 1); ptr = new_cmdline; while ((pos = (char_u *)strstr((char *)program, "$*")) != NULL) { i = (int)(pos - program); @@ -6028,7 +6028,7 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd, break; } - case ct_MODS: { + case ct_MODS: result = quote ? 2 : 0; if (buf != NULL) { if (quote) { @@ -6044,7 +6044,6 @@ static size_t uc_check_code(char_u *code, size_t len, char_u *buf, ucmd_T *cmd, *buf = '"'; } break; - } case ct_REGISTER: result = eap->regname ? 1 : 0; |