cinteger-overflowargvargc

executing a process with argc=0


Is it possible to execute a process whose argc = 0? I need to execute a program but it is extremely important for its argc to be equal to 0. Is there a way to do that? I tried to put 2^32 arguments in the command line so that it appears as if argc = 0 but there is a maximum limit to the number of arguments.


Solution

  • You can write a program that calls exec directly; that allows you to specify the command-line arguments (including the program name) and lack thereof.