summaryrefslogtreecommitdiffstats
path: root/lldb/test
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-12-13 02:02:44 +0000
committerGreg Clayton <gclayton@apple.com>2013-12-13 02:02:44 +0000
commitd3b16b3c03eea800389397bb8747d1e531faf05f (patch)
tree9e737f7e45f433cef1f19da2f8bc7c8c0aa83136 /lldb/test
parent6201712bb0e8e923defa26d66dca1b53e1496534 (diff)
downloadbcm5719-llvm-d3b16b3c03eea800389397bb8747d1e531faf05f.tar.gz
bcm5719-llvm-d3b16b3c03eea800389397bb8747d1e531faf05f.zip
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.
llvm-svn: 197200
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/crashinfo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lldb/test/crashinfo.c b/lldb/test/crashinfo.c
index 8398d14d035..718cb006e92 100644
--- a/lldb/test/crashinfo.c
+++ b/lldb/test/crashinfo.c
@@ -33,10 +33,11 @@ static PyObject* setCrashReporterDescription(PyObject* self, PyObject* string)
{
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;
}
}
OpenPOWER on IntegriCloud