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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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\0within 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\0would indeed split a parameter, the low levelexec()interface uses a list of(char *)s, so an embedded\0would simply terminate the parameter early.