How would you validate that strings of unspecified length is null terminated? There's no way other than actually reading from the string until you find a null byte; you'll do this even if you don't count the checked bytes (like what strlen does).
The only safety you can take is to require an expected maximum string length so that the loop will not run out of safe bounds. But what can be the safe maximum? 2^31-1 is still very huge, if you're supposed to check the length of a parameter in the process command line, the OS or shell usually has some limit, which is generally not more than 64KB. The OS itself will not allow a process to be lauched with a commandline not null-terminated.
In other words this is not a problem of Lua for that case if there's one, but a problem of the OS or shell, if it allows launching processes with unterminated arbitrary string length in the command line buffer (and this bug would occur in the underliong binary API or C using such datatype).
Lua strings have an explicit length field so they are always bounded (Lua uitself should ensure that it can always store the final null byte at end of the buffer): that length filed should be used and then using C's strlen() should be avoided for a function using that bound parameter.