Fix potential buffer overflow and truncation issues
3 files changed