Understanding and mitigating memory corruption attacks