mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
fix: use snprintf instead of sprintf
Clang 14 now reports sprintf as deprecated.
This commit is contained in:

committed by
Lewis Russell

parent
dd0e77d48a
commit
a1bec02c1e
@@ -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;
|
||||
|
Reference in New Issue
Block a user