[lldb/API] Fix non null-terminated stop-reason in SBThread::GetStopDescription
authorMed Ismail Bennani <medismail.bennani@gmail.com>
Wed, 5 Feb 2020 23:15:37 +0000 (00:15 +0100)
committerMed Ismail Bennani <medismail.bennani@gmail.com>
Wed, 5 Feb 2020 23:20:33 +0000 (00:20 +0100)
When trying to get the stop reason description using the SB API, the
buffer fetched was not null-terminated causing failures on the sanitized bot.

This patch should address those failures.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
lldb/source/API/SBThread.cpp

index b215cdd..049a0b2 100644 (file)
@@ -326,7 +326,7 @@ size_t SBThread::GetStopDescription(char *dst, size_t dst_len) {
       StopInfoSP stop_info_sp = exe_ctx.GetThreadPtr()->GetStopInfo();
       if (stop_info_sp) {
         const char *stop_desc =
-            exe_ctx.GetThreadPtr()->GetStopDescription().data();
+            exe_ctx.GetThreadPtr()->GetStopDescription().c_str();
         if (stop_desc) {
           if (dst)
             return ::snprintf(dst, dst_len, "%s", stop_desc);