Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer 'vsnprintf' to 'vsprintf' #5561

Merged
merged 5 commits into from
Nov 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions include/LightGBM/utils/log.h
Expand Up @@ -109,12 +109,13 @@ class Log {
}
static void Fatal(const char *format, ...) {
va_list val;
char str_buf[1024];
const size_t kBufSize = 1024;
char str_buf[kBufSize];
va_start(val, format);
#ifdef _MSC_VER
vsprintf_s(str_buf, format, val);
vsnprintf_s(str_buf, kBufSize, format, val);
#else
vsprintf(str_buf, format, val);
vsnprintf(str_buf, kBufSize, format, val);
#endif
va_end(val);

Expand Down