[client] app: fix format-truncation false positive

This is fixed by using the `valloc_sprintf` function provided in
common/stringutils.h as the functionallity is literally identical.
This commit is contained in:
Geoffrey McRae 2021-02-22 01:39:56 +11:00
parent 99fc650550
commit e79661a924

View File

@ -28,6 +28,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "kb.h"
#include "common/debug.h"
#include "common/stringutils.h"
#include <stdarg.h>
#include <math.h>
@ -448,14 +449,11 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
if (!g_state.lgr || !g_params.showAlerts)
return;
char * buffer;
va_list args;
va_start(args, fmt);
const int length = vsnprintf(NULL, 0, fmt, args);
va_end(args);
char *buffer = malloc(length + 1);
va_start(args, fmt);
vsnprintf(buffer, length + 1, fmt, args);
valloc_sprintf(&buffer, fmt, args);
va_end(args);
g_state.lgr->on_alert(