AntiPattern
Unchecked Buffer Length Writes
unchecked-buffer-length-writes
Buffer-size assumptions fail in multiple places: results are not bounded against allocated capacity, substring sizing uses incorrect/underflow-prone arithmetic, and writes rely on mismatched strlen sources—leading to overflows, corrupted data, and even stack exhaustion.