aboutsummaryrefslogtreecommitdiff
path: root/games/golddig
diff options
context:
space:
mode:
authorJean-Marc Zucconi <jmz@FreeBSD.org>2004-12-02 10:55:58 +0000
committerJean-Marc Zucconi <jmz@FreeBSD.org>2004-12-02 10:55:58 +0000
commitb30183952a11760a26bf6086ab3e49c37c6cb269 (patch)
tree2e83c905fda21a766b2f82b8078511119c3931cb /games/golddig
parent9c645b72cdc92a54b8eaabe84b6f79192998183a (diff)
downloadports-b30183952a11760a26bf6086ab3e49c37c6cb269.tar.gz
ports-b30183952a11760a26bf6086ab3e49c37c6cb269.zip
Avoid buffer overflows.
Submitted by: Niels Heinen <niels.heinen@ubizen.com>
Notes
Notes: svn path=/head/; revision=122973
Diffstat (limited to 'games/golddig')
-rw-r--r--games/golddig/Makefile1
-rw-r--r--games/golddig/files/patch-aa29
2 files changed, 24 insertions, 6 deletions
diff --git a/games/golddig/Makefile b/games/golddig/Makefile
index 593a108e5009..7abdea7af799 100644
--- a/games/golddig/Makefile
+++ b/games/golddig/Makefile
@@ -7,6 +7,7 @@
PORTNAME= golddig
PORTVERSION= 2.0
+PORTREVISION= 1
CATEGORIES= games
MASTER_SITES= ftp://qiclab.scn.rain.com/pub/games/
DISTNAME= golddig2
diff --git a/games/golddig/files/patch-aa b/games/golddig/files/patch-aa
index e644f518ca6d..ced0b8b3c9b6 100644
--- a/games/golddig/files/patch-aa
+++ b/games/golddig/files/patch-aa
@@ -1,5 +1,5 @@
---- shared.c.orig Mon May 1 18:20:48 2000
-+++ shared.c Mon May 1 18:25:28 2000
+--- shared.c.orig Thu Dec 2 11:49:23 2004
++++ shared.c Thu Dec 2 11:52:16 2004
@@ -58,7 +58,7 @@
#include "bitmap/window.bits"
#include "bitmap/anti.bits"
@@ -9,18 +9,35 @@
/* All in and out movements except up */
#define NOUPBITS DLEAVE | LLEAVE | RLEAVE | HENTER | VENTER
-@@ -316,8 +316,12 @@
+@@ -312,21 +312,25 @@
+ FILE *levelfile;
+ register int i,j;
+ int x,y;
+- char buf[300];
++ char buf[1300];
/* Manufaction the file name by starting with the world name and */
/* appending the level number to it. */
- strcpy(filename,LIB);
- strcat(filename,"/");
+- strcat(filename,worldname);
+ if (strchr (worldname, '/'))
+ *filename = 0;
+ else {
-+ strcpy(filename,LIB);
-+ strcat(filename,"/");
++ strncpy(filename,LIB,sizeof(filename) - 3);
++ strncat(filename,"/",sizeof(filename) - 3);
+ }
- strcat(filename,worldname);
++ strncat(filename,worldname,sizeof(filename) - 3);
sprintf(filename + strlen(filename),"%03d",levelnum);
/* Open level file for reading */
+ levelfile = fopen(filename,"r");
+ /* If level file does not exist, use the default level file. */
+ if(levelfile == NULL) {
+ /* Build the default level name */
+- strcpy(buf,LIB);
+- strcat(buf,"/default");
++ strncpy(buf,LIB,sizeof(filename));
++ strncat(buf,"/default",sizeof(filename));
+ /* Open default level file for reading */
+ levelfile = fopen(buf,"r");
+ if(levelfile == NULL) {