c - What if there's '\0' character in command line input? -


int main(int argc,char* argv[]); 

if there's '\0' character in a, split 2 arguments ?

./programe "a" 

i can't reproduce can't put '\0' a,but there might can.

parameters passed programs c strings; in particular, execve() syscall (lowest level visible programs , ether close or identical kernel api) uses c strings, not possible pass \0 within parameter. note that, while usual way parameter vector passed process's address space kernel contiguous, embedded \0 indeed split parameter, low level exec() interface uses list of (char *)s, embedded \0 terminate parameter early.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

c# - SharpSVN - How to get the previous revision? -

php cli reading files and how to fix it? -