Don't use formatted output in WCMD_setshow_sortenv.
Don't use unsafe vsprintf in WCMD_output.
This commit is contained in:
parent
65ad3f2587
commit
a18ea3dd1e
|
@ -792,8 +792,10 @@ static void WCMD_setshow_sortenv(const char *s)
|
|||
qsort( str, count, sizeof (char*), WCMD_compare );
|
||||
|
||||
/* print it */
|
||||
for( i=0; i<count; i++ )
|
||||
WCMD_output("%s\n", str[i] );
|
||||
for( i=0; i<count; i++ ) {
|
||||
WCMD_output_asis(str[i]);
|
||||
WCMD_output_asis("\n");
|
||||
}
|
||||
|
||||
LocalFree( str );
|
||||
}
|
||||
|
|
|
@ -789,10 +789,15 @@ void WCMD_output (const char *format, ...) {
|
|||
|
||||
va_list ap;
|
||||
char string[1024];
|
||||
int ret;
|
||||
|
||||
va_start(ap,format);
|
||||
vsprintf (string, format, ap);
|
||||
ret = vsnprintf (string, sizeof( string), format, ap);
|
||||
va_end(ap);
|
||||
if( ret >= sizeof( string)) {
|
||||
WCMD_output_asis("ERR: output truncated in WCMD_output\n" );
|
||||
string[sizeof( string) -1] = '\0';
|
||||
}
|
||||
WCMD_output_asis(string);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue