Don't use formatted output in WCMD_setshow_sortenv.

Don't use unsafe vsprintf in WCMD_output.
This commit is contained in:
Rein Klazes 2005-12-01 15:58:16 +01:00 committed by Alexandre Julliard
parent 65ad3f2587
commit a18ea3dd1e
2 changed files with 10 additions and 3 deletions

View File

@ -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 );
}

View File

@ -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);
}