Buffer overflow fixes from Steve Kemp and Ulf Harnhammar.

Obtained from:	Debian
This commit is contained in:
Christian Weisgerber 2005-01-11 21:31:48 +00:00
parent c2ec7ecdb2
commit 646f99fca7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=126157
4 changed files with 50 additions and 4 deletions

View file

@ -7,6 +7,7 @@
PORTNAME= xshisen PORTNAME= xshisen
PORTVERSION= 1.36 PORTVERSION= 1.36
PORTREVISION= 1
CATEGORIES= games CATEGORIES= games
MASTER_SITES= http://www.techfirm.co.jp/~masaoki/ MASTER_SITES= http://www.techfirm.co.jp/~masaoki/

View file

@ -1,5 +1,8 @@
--- main.C.orig Sun Dec 12 14:34:28 1999
+++ main.C Sun Dec 12 14:39:33 1999 $FreeBSD$
--- main.C.orig
+++ main.C
@@ -44,53 +44,53 @@ @@ -44,53 +44,53 @@
static XtResource gres[] = { static XtResource gres[] = {
@ -78,3 +81,15 @@
}; };
GlobRes globRes; GlobRes globRes;
@@ -194,9 +194,9 @@
char buffer[100], *p;
char *(*codeconv)(const char*);
- strcpy(buffer, operation);
+ strlcpy(buffer, operation, sizeof(buffer));
if (strchr(buffer, '-') == NULL) {
- strcat(buffer, "-" KANJICODE);
+ strlcat(buffer, "-" KANJICODE, sizeof(buffer));
}
if (strncasecmp(buffer, "jis-euc", 7) == 0)
codeconv = jis_to_euc;

View file

@ -1,5 +1,8 @@
--- score.C.orig Tue Jan 23 00:52:09 1996
+++ score.C Sat Aug 26 05:10:09 2000 $FreeBSD$
--- score.C.orig
+++ score.C
@@ -4,31 +4,31 @@ @@ -4,31 +4,31 @@
XtResource Score::resources[] = { XtResource Score::resources[] = {
@ -58,6 +61,19 @@
} }
void void
@@ -371,10 +377,10 @@
s1 = scoreToRegister / 1000;
ms_to_hms(scoreToRegister, h, m, s);
pw = getpwuid(getuid());
- strcpy(gecos, pw->pw_gecos);
+ strlcpy(gecos, pw->pw_gecos, sizeof(gecos));
if ((po = strchr(gecos, ',')) != NULL)
*po = 0;
- sprintf(namebuf, "%-8.8s (%s)", pw->pw_name, gecos);
+ snprintf(namebuf, sizeof(namebuf), "%-8.8s (%s)", pw->pw_name, gecos);
sprintf(myname, "%-28.28s", namebuf);
// Always read the latest high score
readfile();
@@ -414,7 +420,7 @@ @@ -414,7 +420,7 @@
strcpy(rec[inspos].name, myname); strcpy(rec[inspos].name, myname);
time(&t); time(&t);

View file

@ -0,0 +1,14 @@
$FreeBSD$
--- readxpm.C.orig
+++ readxpm.C
@@ -12,7 +12,7 @@
char buffer[1024];
for(int i=0; i<PKIND; i++) {
- sprintf(buffer, "%s/%s.xpm", directory, files[i]);
+ snprintf(buffer, sizeof(buffer), "%s/%s.xpm", directory, files[i]);
Mp[i].ReadFile(w, buffer, i, globRes.colorCloseness);
}
}