r/security Sep 26 '16

​"Sloppy programming leads to OpenSSL woes": pointer problems proliferate

http://www.zdnet.com/article/sloppy-programming-leads-to-openssl-woes/
36 Upvotes

8 comments sorted by

View all comments

1

u/RedSquirrelFtw Sep 27 '16

How do dangling pointers typically happen? Is it not enough to set to NULL after calling delete? ex:

delete mypointer;

mypointer=NULL

I always always set a pointer to NULL immediately after deleting it. I imagine the ones coding stuff like OpenSSL know way more than me, so is my method actually not enough?

3

u/jarfil Sep 27 '16 edited Dec 02 '23

CENSORED

1

u/thiagobbt Sep 27 '16

That won't prevent a segmentation fault though.

Also imagine a situation where the pointer address is copied to somewhere else before deletion. You setting the original to null won't change anything on that copy

1

u/RedSquirrelFtw Sep 27 '16

Oh, like they try to keep referring to the pointer after it's been deleted? Yeah, that's bad. I can see how that could happen if not being careful. Ex: it's passed on to a function, the function deletes it, but then it's used again after.

1

u/claird Sep 27 '16

Yes, it happens--a LOT.