diff options
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 0764cbec7a..513fb5b202 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -2350,13 +2350,13 @@ bool find_decl(char *ptr, size_t len, bool locally, bool thisblock, int flags_ar bool incll; int searchflags = flags_arg; - pat = xmalloc(len + 7); + size_t patlen = len + 7; + pat = xmalloc(patlen); // Put "\V" before the pattern to avoid that the special meaning of "." // and "~" causes trouble. - assert(len <= INT_MAX); - sprintf(pat, vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s", // NOLINT(runtime/printf) - (int)len, ptr); + assert(patlen <= INT_MAX); + snprintf(pat, patlen, vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s", (int)len, ptr); old_pos = curwin->w_cursor; save_p_ws = p_ws; save_p_scs = p_scs; |