Fixed two buffer overflow problems reported by Clang