From 64066359dda2a0920d307e901185faf78cc32b97 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 25 Aug 2003 16:49:47 -0300 Subject: bug: IBM AS400 (OS400) has sizeof(void *)==16, and a `%p' may generate up to 60 characters in a `printf'. That causes a buffer overflow in `tostring'.. --- liolib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'liolib.c') diff --git a/liolib.c b/liolib.c index 45dc6cb3..112a1fce 100644 --- a/liolib.c +++ b/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.44 2003/07/07 13:32:52 roberto Exp roberto $ +** $Id: liolib.c,v 2.45 2003/07/09 12:08:43 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -152,7 +152,7 @@ static int io_gc (lua_State *L) { static int io_tostring (lua_State *L) { - char buff[32]; + char buff[4*sizeof(void *) + 2]; /* enough space for a `%p' */ FILE **f = topfile(L, 1); if (*f == NULL) strcpy(buff, "closed"); -- cgit v1.2.3-55-g6feb