So a simple strlen would look like
size_t strlen (char *str) {
size_t len = 0;
while (*str != '\0') {
str++;
len++;
}
return len;
}
It's possible that the "user" put the characters "Lua Rocks" into the buffer, but did not put in the null end character.
So the full buffer of "Lua Rocks AI created CWE are the latest spam\0" would be used.
So on the surface this may make sense.
But this is one of a series of issues around doing load strings and loading Lua byte code.
I know that I wake up and go "Hey, what random Lua byte code can I find and load it directly into my system via Lua".
The Lua team is pretty good (30 years worth?) of making sure that the null characters are in the right place.
The problem with these LLM bug reports is context. They lack the ability to roll down the stack and look at the calling code to see "Ok, now slap a null \0 on the end" statements being used.
I follow Daniel, the author of CURL, and his weekly tirades about AI generated CWE slop is pretty awesome.
Roberto is too nice to call these AI_Clowns out. I follow his lead and just hit the delete key after a small, sad sigh.