[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Remove uselles cast (lstrlib.c)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 30 Sep 2020 11:36:26 -0300
> strlen already returns size_t.
> We can securely remove this useless cast?
>
> [...]
> case Kzstr: {
> - size_t len = (int)strlen(data + pos);
> + size_t len = strlen(data + pos);
> luaL_argcheck(L, pos + len < ld, 2,
> "unfinished string for format 'z'");
This is more than useless, it seems to be a bug. (C actually truncates
the result.) But we need a quite long string to hit it.
-- Roberto