diff options
author | Adam Weinberger <adamw@FreeBSD.org> | 2014-07-28 19:39:50 +0000 |
---|---|---|
committer | Adam Weinberger <adamw@FreeBSD.org> | 2014-07-28 19:39:50 +0000 |
commit | d9616e5a763d1ab83ebac479e3b2222db5c3f87f (patch) | |
tree | a08c8f6002f7c1660aaa80e0f9cf61cd9d71151c /games/sxsame/files/patch-loadbmp.c | |
parent | - Update to 1.9, announce message: (diff) |
Rename all 10,000 games/ patch-xy patches to reflect the files they modify.
Notes
Notes:
svn path=/head/; revision=363239
Diffstat (limited to 'games/sxsame/files/patch-loadbmp.c')
-rw-r--r-- | games/sxsame/files/patch-loadbmp.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/games/sxsame/files/patch-loadbmp.c b/games/sxsame/files/patch-loadbmp.c new file mode 100644 index 000000000000..9d193e2ac01a --- /dev/null +++ b/games/sxsame/files/patch-loadbmp.c @@ -0,0 +1,39 @@ +--- loadbmp.c.orig Sun May 5 04:09:25 1996 ++++ loadbmp.c Tue Jul 11 21:30:24 2000 +@@ -5,6 +5,9 @@ + * Copyleft (c) 1994-1996 Software Research Academy * + ************************************************************************/ + #include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include <sys/param.h> + #include <X11/Xlib.h> + #include "sxsame.h" + +@@ -37,17 +40,24 @@ + int c, c1,c2; + int width, height, planes, ncol; + int *col; +- char fname[256]; ++ char fname[MAXPATHLEN]; + + Pixmap w; + GC gc; + int i, j, k; + ++ if (MAXPATHLEN <= strlen(bmpname) ) { ++ fprintf(stderr,"Error: BMP file name too long.\n"); ++ return -1; ++ } + strcpy(fname,bmpname); + fp = fopen(fname,"rb"); + if(fp == NULL) + { +- sprintf(fname, "%s/%s", SAME_DIR, bmpname); ++ if (MAXPATHLEN <= snprintf(fname, MAXPATHLEN, "%s/%s", SAME_DIR, bmpname)) { ++ fprintf(stderr,"Error: BMP file name too long.\n"); ++ return -1; ++ } + fp = fopen(fname, "r"); + if(fp == NULL) + { |