numad_log: fix buffer overflow

This commit is contained in:
Lukas Nykryn 2023-09-06 12:27:47 +02:00
parent d696d6c413
commit 3399d89305
1 changed files with 1 additions and 1 deletions

View File

@ -153,7 +153,7 @@ void numad_log(int level, const char *fmt, ...) {
*p++ = ' '; *p++ = ' ';
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(p, BUF_SIZE, fmt, ap); vsnprintf(p, BUF_SIZE - strlen(buf) , fmt, ap);
va_end(ap); va_end(ap);
fprintf(log_fs, "%s", buf); fprintf(log_fs, "%s", buf);
fflush(log_fs); fflush(log_fs);