Skip to content

Comment on Playing whack-a-mole is losingparent

Comments

The problem is that 0 is a valid UID in POSIX systems like Linux.

If you automatically initialize variables with a garbage value, use-before-initialization (the program’s initialization) them the use of that variable will likely fail due to error. By using what turns out to be a legit UID on every system you have the opportunity for this case not to be detected, perhaps causing a problem immediately or else allowing some nefarious actor to write what they want into that variable instead.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.