CHG: Improved buffer overflow handling