Re: luaO_pushvfstring reads past end of format string on trailing %
Francisco Olarte <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <CA+bJJbzfiqB3Vgpjw6XNWK8+iPkHrw-UZut896i1Bt632-CASg@mail.gmail.com> |
Roberto: On Tue, 11 Aug 2026 at 19:54, Roberto Ierusalimschy <[email protected]> wrote: > > [...] but a case for '\0' may be > > useful, specially since the default behaviour is adding unknown > > formats . > > You can use '%c' with a corresponding 0 to insert '\0'. Thanks, but I was not referring to that. I meant, since "%#", as "%$" and all other invalid sequences just "keep unknown format in the result", do the same for "%\0". Null inserting is not common enough for the ( perceived by my ) target of this function to even suggest "%0" for it, the %c combo is fine. OTOH, as I commented, the input, fmt, is a C string, so "%\0" is not really a two char substring but more of a OOB access, so I would prefer some fix along the lines of testing e[1], if it is considered ( or just let it fall to a "unespecified ( by the manual ) behaviour", but I think it would be better to just fix it, as well as keeping the default handling, because formats like "Done up to %d%" or "Reached %d% phase" are easy to key by mistake ( they plague my C code, thank god GCC as printf checking ). Francisco Olarte. -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/CA%2BbJJbzfiqB3Vgpjw6XNWK8%2BiPkHrw-UZut896i1Bt632-CASg%40mail.gmail.com.