3 ms·
>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.
by akoboldfrying 2y ago
>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.
- jrockway 2y ago"That's one fine looking barbeque pit."
- pavlov 2y agoBecause 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.
- lambdaxyzw 2y agoI 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!