diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-11 17:50:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1995-10-11 17:50:56 -0300 |
| commit | b074306267b70015d770cb33c78dcf6cfe53fb45 (patch) | |
| tree | e1bf80eff174ea79d7567a511a8aa70290084ef4 | |
| parent | 3c75b755167d899c9b65a7e5a622b8e93ce52ed6 (diff) | |
| download | lua-b074306267b70015d770cb33c78dcf6cfe53fb45.tar.gz lua-b074306267b70015d770cb33c78dcf6cfe53fb45.tar.bz2 lua-b074306267b70015d770cb33c78dcf6cfe53fb45.zip | |
bug. "fgets" reads n-1 chars.
| -rw-r--r-- | iolib.c | 4 |
1 files changed, 2 insertions, 2 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** Input/output library to LUA | 3 | ** Input/output library to LUA |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_iolib="$Id: iolib.c,v 1.21 1995/02/06 19:36:13 roberto Exp roberto $"; | 6 | char *rcs_iolib="$Id: iolib.c,v 1.22 1995/10/04 13:53:10 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <stdio.h> | 8 | #include <stdio.h> |
| 9 | #include <ctype.h> | 9 | #include <ctype.h> |
| @@ -251,7 +251,7 @@ static void io_read (void) | |||
| 251 | char f[80]; | 251 | char f[80]; |
| 252 | char s[256]; | 252 | char s[256]; |
| 253 | sprintf (f, "%%%ds", m); | 253 | sprintf (f, "%%%ds", m); |
| 254 | if (fgets (s, m, in) == NULL) | 254 | if (fgets (s, m+1, in) == NULL) |
| 255 | { | 255 | { |
| 256 | lua_pushnil(); | 256 | lua_pushnil(); |
| 257 | return; | 257 | return; |
