# Heap Buffer Overflow

> Detects heap buffer overflows from unsafe memory operations and insufficient size validation.

- Skill: `zakirkun/heap-buffer-overflow` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/heap-buffer-overflow`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/heap-buffer-overflow/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/heap-buffer-overflow

---


# Heap Buffer Overflow

## Overview
Heap overflows occur when data is written beyond the bounds of a dynamically allocated buffer. Unlike stack overflows, heap overflows can overwrite:
- Adjacent allocations (other object data)
- Heap metadata (size, free list pointers)
- Function pointers stored in objects

Modern heap exploitation techniques include:
- Tcache poisoning (glibc)
- Unsafe unlink attacks
- House of Force

## Remediation
- Always validate buffer sizes before copying
- Use safe string functions with explicit size limits
- Enable compiler hardening: `-D_FORTIFY_SOURCE=2`, AddressSanitizer

