[misc] Safer buffering