diff options
author | Ole Loots <ole@monochrom.net> | 2012-05-13 15:31:30 +0000 |
---|---|---|
committer | Ole Loots <ole@monochrom.net> | 2012-05-13 15:31:30 +0000 |
commit | b1a2191fbe738fa71b2d9228e8212a6ffe3d5c07 (patch) | |
tree | 9d4df7692fc89b32f319ab362172feb2b0ea3ad2 /atari/download.c | |
parent | 560d5d2035793e8902d68ba94294dce0fe549d2f (diff) | |
download | netsurf-b1a2191fbe738fa71b2d9228e8212a6ffe3d5c07.tar.gz netsurf-b1a2191fbe738fa71b2d9228e8212a6ffe3d5c07.tar.bz2 |
Use safe string functions.
svn path=/trunk/netsurf/; revision=13923
Diffstat (limited to 'atari/download.c')
-rwxr-xr-x | atari/download.c | 9 |
1 files changed, 5 insertions, 4 deletions
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) );
|