pkgsrc/games/xboing/patches/patch-af
snj 8494207f32 strcpy and sprintf are evil, don't use them. Inspired by similar changes
in Debian.  This fixes several locally exploitable vulnerabilities.
2004-02-28 18:36:38 +00:00

31 lines
1.3 KiB
Text

$NetBSD: patch-af,v 1.1 2004/02/28 18:36:38 snj Exp $
--- editor.c.orig 2004-02-28 10:06:52.000000000 -0800
+++ editor.c 2004-02-28 10:10:24.000000000 -0800
@@ -213,7 +213,7 @@ static void DoLoadLevel(display, window)
/* Construct the Edit level filename */
if ((str = getenv("XBOING_LEVELS_DIR")) != NULL)
- sprintf(levelPath, "%s/editor.data", str);
+ snprintf(levelPath, sizeof(levelPath), "%s/editor.data", str);
else
sprintf(levelPath, "%s/editor.data", LEVEL_INSTALL_DIR);
@@ -959,7 +959,7 @@ static void LoadALevel(display)
{
/* Construct the Edit level filename */
if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
- sprintf(levelPath, "%s/level%02ld.data", str2, (u_long) num);
+ snprintf(levelPath, sizeof(levelPath), "%s/level%02ld.data", str2, (u_long) num);
else
sprintf(levelPath, "%s/level%02ld.data",
LEVEL_INSTALL_DIR, (u_long) num);
@@ -1019,7 +1019,7 @@ static void SaveALevel(display)
{
/* Construct the Edit level filename */
if ((str2 = getenv("XBOING_LEVELS_DIR")) != NULL)
- sprintf(levelPath, "%s/level%02ld.data", str2, (u_long) num);
+ snprintf(levelPath, sizeof(levelPath), "%s/level%02ld.data", str2, (u_long) num);
else
sprintf(levelPath, "%s/level%02ld.data",
LEVEL_INSTALL_DIR, (u_long) num);