diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-25 16:49:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-08-25 16:49:47 -0300 |
commit | 64066359dda2a0920d307e901185faf78cc32b97 (patch) | |
tree | 9a96a621d304931cc8658cb4d92ee3592a9975d3 /liolib.c | |
parent | 97af24ea3246dca0258ba7089cf2df7ac2080560 (diff) | |
download | lua-64066359dda2a0920d307e901185faf78cc32b97.tar.gz lua-64066359dda2a0920d307e901185faf78cc32b97.tar.bz2 lua-64066359dda2a0920d307e901185faf78cc32b97.zip |
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'..
Diffstat (limited to 'liolib.c')
-rw-r--r-- | liolib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: liolib.c,v 2.44 2003/07/07 13:32:52 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.45 2003/07/09 12:08:43 roberto Exp roberto $ |
3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -152,7 +152,7 @@ static int io_gc (lua_State *L) { | |||
152 | 152 | ||
153 | 153 | ||
154 | static int io_tostring (lua_State *L) { | 154 | static int io_tostring (lua_State *L) { |
155 | char buff[32]; | 155 | char buff[4*sizeof(void *) + 2]; /* enough space for a `%p' */ |
156 | FILE **f = topfile(L, 1); | 156 | FILE **f = topfile(L, 1); |
157 | if (*f == NULL) | 157 | if (*f == NULL) |
158 | strcpy(buff, "closed"); | 158 | strcpy(buff, "closed"); |