Security Operations
A C network daemon crashes intermittently. Crash dumps show a pointer dereferenced after its heap block was freed, and that block had been reallocated holding attacker-supplied data. Which change best addresses the root cause?
Show the answer
Correct answerA. Use managed or memory-safe ownership of heap objects
AWhy this is right: enforced ownership or a memory-safe language prevents a freed object from being dereferenced.
BWhy not this: locking fixes concurrent access to shared data and does not stop a dangling pointer.
CWhy not this: bounds checks stop writes past a buffer's end, but this flaw is access to freed memory.
DWhy not this: ASLR only makes exploitation harder; the dangling pointer is still there.
This is a use-after-free, an unsafe memory handling flaw. Memory-safe languages or enforced ownership rules prevent a freed object from being used. Bounds checks fix out-of-range writes, which is a different flaw, so they would not stop a dangling pointer.