int main(int argc,char* argv[]);
If there's a '\0'
character in A
, will it be split into 2 arguments ?
./programe "A"
I can't reproduce it easily as I can't put an '\0'
into A,but there might be someone who can.
int main(int argc,char* argv[]);
If there's a '\0'
character in A
, will it be split into 2 arguments ?
./programe "A"
I can't reproduce it easily as I can't put an '\0'
into A,but there might be someone who can.
Parameters are passed into programs as C strings; in particular, the execve()
syscall (lowest level visible to programs and generally ether very close to or identical to the kernel API) uses C strings, so it is not possible to pass \0
within a parameter. Note that, while the usual way the parameter vector is passed into the process's address space by the kernel is contiguous, so that an embedded \0
would indeed split a parameter, the low level exec()
interface uses a list of (char *)
s, so an embedded \0
would simply terminate the parameter early.