logoalt Hacker News

gumbytoday at 6:09 PM0 repliesview on HN

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.