[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: games/xpat2



On Thu, 28 Aug 2003, Anil Madhavapeddy wrote:

> anyone play this game?  looks like the save routine might throw stack garbage in.
> if you could test this patch that would be good.

That filename[64] should really be filename[MAXPATHLEN] and the
appropriate include added if necessary. Where it gets this filename from
should be checked throughly as it could potentially be passed a filename
that is MAXPATHLEN from somewhere.


>
> Index: patches/patch-src_loadsave_c
> ===================================================================
> RCS file: patches/patch-src_loadsave_c
> diff -N patches/patch-src_loadsave_c
> --- /dev/null   1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_loadsave_c        28 Aug 2003 17:20:00 -0000
> @@ -0,0 +1,15 @@
> +$OpenBSD$
> +--- src/loadsave.c.orig        2003-08-28 13:11:10.000000000 -0400
> ++++ src/loadsave.c     2003-08-28 13:14:20.000000000 -0400
> +@@ -154,9 +154,9 @@ void save_game(const char *file) {
> +     FILE *fp;
> +     char buffer[32];
> +     char filename[64];        /* must be 15 at least */
> +-    long args[24];
> ++    long args[NARGS];
> +     int i;
> +-    unsigned char p[4 * 24];
> ++    unsigned char p[4 * NARGS];
> +
> +     if (!file) {
> +       /* compute the filename to use */
>
>
> Scanned by SCIT E-Mail Gateway http://www.cit.uws.edu.au
>
>



------------------------------------------------------

Ian McWilliam
Technical Officer
School of Computing & IT
University of Western Sydney.

"Technician was the lowest rank on this ship. even
the man who changed the bog roll was higher than us."
- Dave lister, Red Dwarf.
------------------------------------------------------


Scanned by SCIT E-Mail Gateway http://www.cit.uws.edu.au