From 90c5e88130a7d154dc434cab89b359e6e58b6a19 Mon Sep 17 00:00:00 2001 From: Christian Weisgerber Date: Tue, 2 Mar 2004 22:48:03 +0000 Subject: Prevent buffer overflow from environment variable. Obtained from: Ulf Harnhammar and Debian --- games/lbreakout2/files/patch-src_editor.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 games/lbreakout2/files/patch-src_editor.c (limited to 'games/lbreakout2/files/patch-src_editor.c') diff --git a/games/lbreakout2/files/patch-src_editor.c b/games/lbreakout2/files/patch-src_editor.c new file mode 100644 index 000000000000..126c0d7e8bfa --- /dev/null +++ b/games/lbreakout2/files/patch-src_editor.c @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- src/editor.c.orig Tue Mar 2 21:26:03 2004 ++++ src/editor.c Tue Mar 2 21:27:00 2004 +@@ -725,7 +725,7 @@ + { + FILE *file = 0; + /* set full file name */ +- sprintf( edit_file_name, "%s/%s/lbreakout2-levels/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME, file_name ); ++ snprintf( edit_file_name, sizeof(edit_file_name), "%s/%s/lbreakout2-levels/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME, file_name ); + /* test this file for write access. use append to keep contents */ + if ( ( file = fopen( edit_file_name, "a" ) ) == 0 ) { + fprintf( stderr, "Permission to write to file '%s' denied.\n", edit_file_name ); -- cgit v1.2.3