Don't buffer overflow when reading the config file.

Obtained from:	OpenBSD
This commit is contained in:
Kris Kennaway 2001-08-23 08:30:29 +00:00
parent fb1741b002
commit 0d2b758767
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=46690
2 changed files with 30 additions and 0 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= wmcube
PORTVERSION= 0.98
PORTREVISION= 1
CATEGORIES= sysutils windowmaker
MASTER_SITES= http://boombox.campus.luth.se/files/

View File

@ -0,0 +1,29 @@
--- wmcube.c.orig Mon Oct 23 22:11:47 2000
+++ wmcube.c Tue May 15 16:17:02 2001
@@ -913,7 +926,7 @@ int loadobj(char *filename) {
exit(0);
}
- fscanf(fp,"%s",tmp);
+ fscanf(fp,"%63s",tmp);
if (strcmp(tmp,"WMCUBE_COORDINATES") != 0) {
printf("\nError in objectfile: it must start with WMCUBE_COORDINATES\n\n");
@@ -921,7 +934,7 @@ int loadobj(char *filename) {
exit(0);
}
- fscanf(fp,"%s",tmp);
+ fscanf(fp,"%63s",tmp);
counter = atoi(tmp);
while ((strcmp(tmp,"WMCUBE_LINES") != 0) && (strcmp(tmp,"WMCUBE_PLANES") != 0)) {
@@ -938,7 +951,7 @@ int loadobj(char *filename) {
fclose(fp);
exit(0);
}
- fscanf(fp,"%s",tmp);
+ fscanf(fp,"%63s",tmp);
if (feof(fp)) {
printf("\nError in objectfile: you must have a section WMCUBE_LINES or WMCUBE_PLANES\n\n");