Fixed buffer overflow reported by Argiris Kirtzidis.
[oota-llvm.git] / lib / Bitcode / Reader / Deserialize.cpp
index 8455d0e630f5ec9eb425af13666824280f9106f2..113321fa26f28c1fe548c84cc3bc52caf0501673 100644 (file)
@@ -324,7 +324,7 @@ char* Deserializer::ReadCStr(char* cstr, unsigned MaxLen, bool isNullTerm) {
     cstr[i] = (char) ReadInt();
   
   if (isNullTerm)
-    cstr[len+1] = '\0';
+    cstr[len] = '\0';
   
   return cstr;
 }