diff options
author | Lewis Russell <lewis6991@gmail.com> | 2023-08-13 10:29:43 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2023-08-31 15:12:35 +0100 |
commit | a1bec02c1e105eb9f49d577e04bdbeadd5a05e38 (patch) | |
tree | 894faacc22be90a78ba9c7d4ae9072782d465439 /src/nvim/normal.c | |
parent | dd0e77d48a843fc9730fe4ef7567330daf8dfb81 (diff) | |
download | rneovim-a1bec02c1e105eb9f49d577e04bdbeadd5a05e38.tar.gz rneovim-a1bec02c1e105eb9f49d577e04bdbeadd5a05e38.tar.bz2 rneovim-a1bec02c1e105eb9f49d577e04bdbeadd5a05e38.zip |
fix: use snprintf instead of sprintf
Clang 14 now reports sprintf as deprecated.
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; |