News for hackers. Stuff that matters.
Re:What is your favorite C programming trick? (2009) by Gibbon1 on Sunday November 22, 2020 @05:47PM (#25181852)
Big reason for defensive coding like nulling pointers is to make the code fail hard when someone messes up when they make a change. One can imagine the sort of hell unleashed if later the code is changed to make use of a dangling pointer. That's often the type of bug that slips through testing and ends up causing rare unexplained crashes/corruption in shipped code. Worse it can take multiple iterations of changes to finally expose the bug.
Re:What is your favorite C programming trick? (2009) by saagarjha on Monday November 23, 2020 @03:25AM (#25184665)
This makes UAF easier to detect but double-free impossible to detect. I would consider that to be worse than not doing anything at all, especially since it isn't amenable to modern tooling that is much better at catching these issues than hand-rolled defensive coding.