Use c_str() to force the string to be nul-terminated.
authorDan Gohman <gohman@apple.com>
Fri, 6 Mar 2009 18:13:15 +0000 (18:13 +0000)
committerDan Gohman <gohman@apple.com>
Fri, 6 Mar 2009 18:13:15 +0000 (18:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66279 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/PrettyStackTrace.cpp

index 727f9a8f0a7c3ee8c5bb4ee99085ee7a84eaef5d..77ae5844ce88ac014a1c573cace6f1a6a4111142 100644 (file)
@@ -66,7 +66,7 @@ static void CrashHandler(void *Cookie) {
   }
   
   if (!TmpStr.empty()) {
-    __crashreporter_info__ = strdup(&TmpStr[0]);
+    __crashreporter_info__ = strdup(TmpStr.c_str());
     errs() << __crashreporter_info__;
     errs().flush();
   }