mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-29 01:56:27 +00:00
[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:
parent
99fc650550
commit
e79661a924
@ -28,6 +28,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "kb.h"
|
#include "kb.h"
|
||||||
|
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/stringutils.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@ -448,14 +449,11 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
|
|||||||
if (!g_state.lgr || !g_params.showAlerts)
|
if (!g_state.lgr || !g_params.showAlerts)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
char * buffer;
|
||||||
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
const int length = vsnprintf(NULL, 0, fmt, args);
|
valloc_sprintf(&buffer, fmt, args);
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
char *buffer = malloc(length + 1);
|
|
||||||
va_start(args, fmt);
|
|
||||||
vsnprintf(buffer, length + 1, fmt, args);
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
g_state.lgr->on_alert(
|
g_state.lgr->on_alert(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user