diff options
author | James McCoy <jamessan@jamessan.com> | 2021-05-06 00:01:43 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2021-05-06 18:57:21 -0400 |
commit | d4fd139c2ab950ca3b6916f68911726bef57fbe9 (patch) | |
tree | bb92c7b14724d4b6908cd4aa2214321353287d8e | |
parent | 9bdbac6712fae4c301668535dd4c3ade0ed30eb0 (diff) | |
download | rneovim-d4fd139c2ab950ca3b6916f68911726bef57fbe9.tar.gz rneovim-d4fd139c2ab950ca3b6916f68911726bef57fbe9.tar.bz2 rneovim-d4fd139c2ab950ca3b6916f68911726bef57fbe9.zip |
coverity/331366: fname_trans_sid: Avoid buffer overrun
Since we're printf()ing into an offset of fname_buf, we need to reduce
the max length by the same amount.
-rw-r--r-- | src/nvim/eval/userfunc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 00260bc3f7..dc7027980e 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -537,7 +537,7 @@ static char_u *fname_trans_sid(const char_u *const name, if (current_sctx.sc_sid <= 0) { *error = ERROR_SCRIPT; } else { - snprintf((char *)fname_buf + 3, FLEN_FIXED + 1, "%" PRId64 "_", + snprintf((char *)fname_buf + i, FLEN_FIXED + 1 - i, "%" PRId64 "_", (int64_t)current_sctx.sc_sid); i = (int)STRLEN(fname_buf); } |