[Lldb-commits] [lldb] r197200 - Fixed the size of the malloc buffer to match the size of the string that is memcpy'ed so we don't crash in a fiery ball of death when running the test suite on darwin.

Greg Clayton gclayton at apple.com
Thu Dec 12 18:02:44 PST 2013


Author: gclayton
Date: Thu Dec 12 20:02:44 2013
New Revision: 197200

URL: http://llvm.org/viewvc/llvm-project?rev=197200&view=rev
Log:
Fixed the size of the malloc buffer to match the size of the string that is memcpy'ed so we don't crash in a fiery ball of death when running the test suite on darwin.


Modified:
    lldb/trunk/test/crashinfo.c

Modified: lldb/trunk/test/crashinfo.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/crashinfo.c?rev=197200&r1=197199&r2=197200&view=diff
==============================================================================
--- lldb/trunk/test/crashinfo.c (original)
+++ lldb/trunk/test/crashinfo.c Thu Dec 12 20:02:44 2013
@@ -33,10 +33,11 @@ static PyObject* setCrashReporterDescrip
 	{
 		Py_ssize_t size = PyString_Size(string);
 		char* data = PyString_AsString(string);
-		if (size && data)
+		if (size > 0 && data)
 		{
+            ++size; // Include the NULL terminateor in allocation and memcpy()
 			__crashreporter_info__ = malloc(size);
-			memcpy(__crashreporter_info__,data,size+1);
+			memcpy(__crashreporter_info__, data, size);
 			return Py_True;
 		}
 	}





More information about the lldb-commits mailing list