Handling argc==0 in the kernel
Handling argc==0 in the kernel
Posted Jan 28, 2022 17:12 UTC (Fri) by matthias (subscriber, #94967)In reply to: Handling argc==0 in the kernel by larkey
Parent article: Handling argc==0 in the kernel
> for (**arg = &argv[1]; arg < &argv[argc]; arg++)
Disallowing argv[0] still allows for this pattern. The security problem arises with applications relying on argc>0 (like pkexec did).
And there is really no reason to disallow argv == NULL (in the execve()-call) while allowing argv[0] == NULL. As Linux constructs the { NULL } array, both things cannot be distinguished from the called application. There is no reason to get all the compatibility problems arising from disallowing argv == NULL without gaining any security benefit. Either we want the get rid of the security issues. Then we have to disallow argv[0] == NULL. Or we can leave everything as it is now.
