From b1a2191fbe738fa71b2d9228e8212a6ffe3d5c07 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Sun, 13 May 2012 15:31:30 +0000 Subject: Use safe string functions. svn path=/trunk/netsurf/; revision=13923 --- atari/download.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'atari/download.c') diff --git a/atari/download.c b/atari/download.c index e8f916515..8ced4c31d 100755 --- a/atari/download.c +++ b/atari/download.c @@ -137,7 +137,7 @@ static char * select_filepath( const char * path, const char * filename ) if( mt_FselInput( &app, res_path, res_file, (char*)"*", (char*)messages_get("SaveAsNS"), res_path, NULL ) ) { assert( (strlen( res_path ) + strlen( res_file ) + 2) < PATH_MAX ); - sprintf(tmp, "%s%s", res_path, res_file ); + snprintf(tmp, PATH_MAX, "%s%s", res_path, res_file ); ret = malloc( strlen(tmp)+1 ); strcpy( ret, tmp ); } @@ -173,10 +173,11 @@ struct gui_download_window *gui_download_window_create(download_context *ctx, return( NULL ); destination = tmp; } else { + int dstsize=0; gemdos_realpath(nsoption_charp(downloads_path), gdos_path); - destination = malloc( strlen(gdos_path)+1 - + strlen(filename)+1 ); - sprintf( destination, "%s/%s", gdos_path, filename ); + dstsize = strlen(gdos_path) + strlen(filename) + 2; + destination = malloc( dstsize ); + snprintf( destination, dstsize, "%s/%s", gdos_path, filename ); } gdw = calloc( 1, sizeof(struct gui_download_window) ); -- cgit v1.2.3