$OpenBSD: patch-src_theme_c,v 1.1 2004/03/02 22:18:53 naddy Exp $ --- src/theme.c.orig 2002-02-19 15:12:22.000000000 +0100 +++ src/theme.c 2004-03-02 21:55:07.000000000 +0100 @@ -115,7 +115,7 @@ SDL_Surface* theme_load_surf( char *name { SDL_Surface *surf = 0; char path[512]; - sprintf( path, "%s/.lgames/lbreakout2-themes/%s/%s", getenv( "HOME" ), theme_name, name ); + snprintf( path, sizeof(path), "%s/.lgames/lbreakout2-themes/%s/%s", getenv( "HOME" ), theme_name, name ); if ( strequal( theme_name, "Default" ) || ( surf = load_surf( path, SDL_SWSURFACE | SDL_NONFATAL ) ) == 0 ) surf = load_surf( name, SDL_SWSURFACE ); return surf; @@ -125,7 +125,7 @@ Sound_Chunk* theme_load_sound( char *nam { Sound_Chunk *sound = 0; char path[512]; - sprintf( path, "%s/.lgames/lbreakout2-themes/%s/%s", getenv( "HOME" ), theme_name, name ); + snprintf( path, sizeof(path), "%s/.lgames/lbreakout2-themes/%s/%s", getenv( "HOME" ), theme_name, name ); if ( strequal( theme_name, "Default" ) || ( sound = sound_chunk_load( path ) ) == 0 ) sound = sound_chunk_load( name ); return sound; @@ -135,7 +135,7 @@ Font* theme_load_font_fixed( char *name, { Font *font = 0; char path[512]; - sprintf( path, "%s/.lgames/lbreakout2-themes/%s/%s", getenv( "HOME" ), theme_name, name ); + snprintf( path, sizeof(path), "%s/.lgames/lbreakout2-themes/%s/%s", getenv( "HOME" ), theme_name, name ); if ( strequal( theme_name, "Default" ) || ( font = load_fixed_font( path, start, len, width, SDL_SWSURFACE | SDL_NONFATAL ) ) == 0 ) font = load_fixed_font( name, start, len, width, SDL_SWSURFACE ); return font; @@ -201,7 +201,7 @@ void theme_load_bkgnds() struct stat filestat; char path[512]; char fname[512]; - sprintf( fname, "%s/.lgames/lbreakout2-themes/%s/back0.png", getenv( "HOME" ), theme_name ); + snprintf( fname, sizeof(path), "%s/.lgames/lbreakout2-themes/%s/back0.png", getenv( "HOME" ), theme_name ); if ( strequal( theme_name, "Default" ) || stat( fname, &filestat ) == -1 ) { /* use original backs */ bkgnd_count = BACK_COUNT; @@ -209,7 +209,7 @@ void theme_load_bkgnds() } else { /* use new backs */ - sprintf( path, "%s/.lgames/lbreakout2-themes/%s", getenv( "HOME" ), theme_name ); + snprintf( path, sizeof(path), "%s/.lgames/lbreakout2-themes/%s", getenv( "HOME" ), theme_name ); bkgnd_count = -1; do { bkgnd_count++; @@ -248,7 +248,7 @@ void theme_get_list() /* auxilary list */ list = list_create( LIST_NO_AUTO_DELETE, NO_CALLBACK ); /* theme directory */ - sprintf( dir, "%s/.lgames/lbreakout2-themes", getenv( "HOME" ) ); + snprintf( dir, sizeof(dir), "%s/.lgames/lbreakout2-themes", getenv( "HOME" ) ); if ( ( hdir = opendir( dir ) ) != 0 ) { while ( ( entry = readdir( hdir ) ) ) { if ( entry->d_name[0] == '.' )