I was reading this article http://blog.regehr.org/archives/213 It contains an example at the bottom of the page from the Linux kernel (slightly edited)
static void __devexit agnx_pci_remove (struct pci_dev *pdev)
{
struct ieee80211_hw *dev = pci_get_drvdata(pdev);
struct agnx_priv *priv = dev->priv;
if (!dev) return;
... do stuff using dev ...
}
The article claims
As we can now easily see, neither case necessitates a null pointer check. The check is removed, potentially creating an exploitable security vulnerability.
If they dereferenced a null pointer would it not segfault? They would not even get to the check right?
What can this vulnerability be?
EDIT: I read the article and I understand it! I want to understand why people coded it this way anyway, perhaps it was deliberate? At least for me just because a guy claims it to be a mistake on his blog, does not mean that it is, so I want to double check it. What's wrong with that?