Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>malloc("HTTP")

I'm reminded of a Simpsons episode where Homer tries to assemble a barbecue by pressing a brick and a piece of pipe together.



Because I am the one, my custom malloc checks a given size against the list of known constant string pointers and if it matches, it calls strdup instead.

So easy to program defensively in C.


I guess you could check if the pointer points inside a data section of your program, and if yes, call strlen on it. It's all so easy!


"That's one fine looking barbeque pit."




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: