diff options
author | Christopher Schwarz <lakitu7@gmail.com> | 2009-10-26 05:41:41 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:08 +0000 |
commit | ab754441e855a563df4e5c56a3cfb2143209fd91 (patch) | |
tree | 409e61644cface9820d41b2d577b956797010fba /src | |
parent | 7c9bc2f1081a30e447634fe4c4b3f45455c9d467 (diff) |
* Fix buffer-safety issues in the download prompt code
Diffstat (limited to 'src')
-rw-r--r-- | src/client/cl_main.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/client/cl_main.c b/src/client/cl_main.c index e4982be3..7efff61a 100644 --- a/src/client/cl_main.c +++ b/src/client/cl_main.c @@ -1968,8 +1968,9 @@ void CL_NextDownload(void) prompt = com_downloadPrompt->integer; if( !( prompt & DLP_TYPE_MASK ) && !( cl_allowDownload->integer & DLF_ENABLE ) ) { - char files[ MAX_INFO_STRING ], *name, *head, *pure_msg, - *url_msg = ""; + char files[ MAX_INFO_STRING ] = ""; + char *name, *head, *pure_msg; + char *url_msg = ""; int i = 0, others = 0, swap = 0, max_list = 12; // Set the download URL message @@ -1995,8 +1996,9 @@ void CL_NextDownload(void) *head = 0; if( i++ < max_list ) { - Com_sprintf( files, sizeof( files ), "%s%s%s", - files, i > 1 ? ", " : "", name ); + if( i > 1 ) + Q_strcat( files, sizeof( files ), ", " ); + Q_strcat( files, sizeof( files ), name ); } else { others++; } @@ -2014,9 +2016,8 @@ void CL_NextDownload(void) } while( *head ); if( others ) { - Com_sprintf( files, sizeof( files ), - "%s (%d other file%s)\n", files, others, - others > 1 ? "s" : "" ); + Q_strcat( files, sizeof( files ), va( "(%d other file%s)\n", + others, others > 1 ? "s" : "" ) ); } // Set the pure message |