Fix off-by-one error in err_chunkid().

This commit is contained in:
Mike Pall 2009-12-14 02:28:22 +01:00
parent ef885f476e
commit 547508f36f

View File

@ -204,7 +204,7 @@ static void err_chunkid(char *out, const char *src)
strcpy(out, src); strcpy(out, src);
} else { /* out = [string "string"] */ } else { /* out = [string "string"] */
size_t len; /* Length, up to first control char. */ size_t len; /* Length, up to first control char. */
for (len = 0; len < LUA_IDSIZE-11; len++) for (len = 0; len < LUA_IDSIZE-12; len++)
if (((const unsigned char *)src)[len] < ' ') break; if (((const unsigned char *)src)[len] < ' ') break;
strcpy(out, "[string \""); out += 9; strcpy(out, "[string \""); out += 9;
if (src[len] != '\0') { /* must truncate? */ if (src[len] != '\0') { /* must truncate? */