mirror of
https://github.com/neovim/neovim.git
synced 2025-12-22 14:18:56 +00:00
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.
This commit is contained in:
@@ -537,7 +537,7 @@ static char_u *fname_trans_sid(const char_u *const name,
|
|||||||
if (current_sctx.sc_sid <= 0) {
|
if (current_sctx.sc_sid <= 0) {
|
||||||
*error = ERROR_SCRIPT;
|
*error = ERROR_SCRIPT;
|
||||||
} else {
|
} 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);
|
(int64_t)current_sctx.sc_sid);
|
||||||
i = (int)STRLEN(fname_buf);
|
i = (int)STRLEN(fname_buf);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user