diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-09-18 13:33:14 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-09-18 13:33:14 -0300 |
commit | 93d3c8450c7a78321cf7f9db9173d46c62ebe958 (patch) | |
tree | ba2626af9edbf90afdb02edb836020c693742d99 /lstrlib.c | |
parent | 8667f29c3b9e56fb6bd4f9de8c096e0331be555d (diff) | |
download | lua-93d3c8450c7a78321cf7f9db9173d46c62ebe958.tar.gz lua-93d3c8450c7a78321cf7f9db9173d46c62ebe958.tar.bz2 lua-93d3c8450c7a78321cf7f9db9173d46c62ebe958.zip |
bug: string.format("%") reads past the string
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstrlib.c,v 1.133 2006/06/22 16:12:59 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.134 2006/09/11 14:07:24 roberto Exp roberto $ |
3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -723,7 +723,7 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { | |||
723 | 723 | ||
724 | static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { | 724 | static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { |
725 | const char *p = strfrmt; | 725 | const char *p = strfrmt; |
726 | while (strchr(FLAGS, *p)) p++; /* skip flags */ | 726 | while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ |
727 | if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) | 727 | if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) |
728 | luaL_error(L, "invalid format (repeated flags)"); | 728 | luaL_error(L, "invalid format (repeated flags)"); |
729 | if (isdigit(uchar(*p))) p++; /* skip width */ | 729 | if (isdigit(uchar(*p))) p++; /* skip width */ |