Fixed two buffer overflow errors reported by clang