Hacker News new | ask | show | jobs
by fallingsquirrel 661 days ago
You can do this without assuming the name by execing /proc/$PID/exe. Then you're not vulnerable to the argv[0] spoofing described in the article. (But of course since argv[0] does exist, you should set it properly and pass through your own argv[0] unchanged.)
2 comments

That's not portable, though. OpenBSD, for example, doesn't have /proc.
That’s Linux only. Wouldn’t even work on macOS, which would likely be a significant number of your users.