ec03d9af91
Prevent buffer overflow from environment variable; from Debian.
13 lines
663 B
Plaintext
13 lines
663 B
Plaintext
$OpenBSD: patch-src_config_c,v 1.1 2004/03/02 22:18:53 naddy Exp $
|
|
--- src/config.c.orig 2002-02-22 12:58:37.000000000 +0100
|
|
+++ src/config.c 2004-03-02 21:55:07.000000000 +0100
|
|
@@ -40,7 +40,7 @@ Config config;
|
|
void config_check_dir()
|
|
{
|
|
char level_dir[512];
|
|
- sprintf( config.dir_name, "%s/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
|
|
+ snprintf( config.dir_name, sizeof(config.dir_name), "%s/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
|
|
/* test and create .lgames */
|
|
if ( opendir( config.dir_name ) == 0 ) {
|
|
fprintf( stderr, "couldn't find/open config directory '%s'\n", config.dir_name );
|