T
Thomas Rogg
Hello NG,
in my program I use the following function:
void write_log(char *format, ...)
{
va_list arg;
char txt[512];
// Get string
va_start(arg, format);
vsprintf(txt, format, arg); // TODO: txt might overflow
va_end(arg);
// Write to stdout
if(debug_console)
write_console(debug_console, txt);
printf(txt);
}
Is there any safe alternative to vsprintf? I do not want to change the
way I am passing the parameters, because I used this function in
thousands of code lines of a project I've been writing for two years now.
Thank you,
Thomas Rogg
in my program I use the following function:
void write_log(char *format, ...)
{
va_list arg;
char txt[512];
// Get string
va_start(arg, format);
vsprintf(txt, format, arg); // TODO: txt might overflow
va_end(arg);
// Write to stdout
if(debug_console)
write_console(debug_console, txt);
printf(txt);
}
Is there any safe alternative to vsprintf? I do not want to change the
way I am passing the parameters, because I used this function in
thousands of code lines of a project I've been writing for two years now.
Thank you,
Thomas Rogg