convert printf(buffer) to puts(buffer) to avoid security issues/warnings

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1433 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Mike Frysinger 16 years ago
parent b1aeb2c126
commit 8c5d69aab4

@ -4,6 +4,11 @@
prefix to all local variables named "exit" to avoid shadowing the system
exit() function.
* src/cmd/print.c (cmd_print_run): Use puts() to display the formatted buffer
rather than printf() to avoid security issues with dynamically generated
format strings, and to avoid warnings generated by such compilers:
print.c:111: warning: format not a string literal and no format arguments
2009-02-11 Arnim Laeuger <arniml@users.sourceforge.net>
* src/bsdl/bsdl_sem.c: return proper error code to upper level

@ -95,7 +95,7 @@ cmd_print_run( chain_t *chain, char *params[] )
part_t *part;
instruction *inst;
snprintf( format, 128, _(" Active %%-%ds %%-%ds\n"),
snprintf( format, 128, _(" Active %%-%ds %%-%ds"),
MAXLEN_INSTRUCTION, MAXLEN_DATA_REGISTER );
#if HAVE_SWPRINTF
if (mbstowcs( wformat, format, 128 ) == -1)
@ -108,7 +108,7 @@ cmd_print_run( chain_t *chain, char *params[] )
if (mbstowcs( wheader, header, 128 ) == -1)
printf( _("(%d) String conversion failed!\n"), __LINE__ );
#endif /* HAVE_SWPRINTF */
printf( header );
puts( header );
for (i = 0; i < wcslen( wheader ); i++ )
putchar( '-' );
@ -130,7 +130,7 @@ cmd_print_run( chain_t *chain, char *params[] )
}
if (noheader == 0) {
snprintf( format, 128, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds\n"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING,
snprintf( format, 128, _(" No. %%-%ds %%-%ds %%-%ds %%-%ds %%-%ds"), MAXLEN_MANUFACTURER, MAXLEN_PART, MAXLEN_STEPPING,
MAXLEN_INSTRUCTION, MAXLEN_DATA_REGISTER );
#if HAVE_SWPRINTF
if (mbstowcs( wformat, format, 128 ) == -1)
@ -143,7 +143,7 @@ cmd_print_run( chain_t *chain, char *params[] )
if (mbstowcs( wheader, header, 128 ) == -1)
printf( _("(%d) String conversion failed!\n"), __LINE__ );
#endif /* HAVE_SWPRINTF */
printf( header );
puts( header );
for (i = 0; i < wcslen( wheader ); i++ )
putchar( '-' );

Loading…
Cancel
Save