]> granicus.if.org Git - clang/commitdiff
Fix use after free, found by Benjamin Kramer.
authorDaniel Dunbar <daniel@zuster.org>
Sat, 23 May 2009 18:55:58 +0000 (18:55 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 23 May 2009 18:55:58 +0000 (18:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72333 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/HostInfo.cpp

index fc6b87f5c6f71890bf472f522a3cbdf377668706..f60d25e754f44686f041fed5b58d078ce377fb12 100644 (file)
@@ -79,12 +79,12 @@ DarwinHostInfo::DarwinHostInfo(const Driver &D, const llvm::Triple& Triple)
 
   assert(memcmp(&getOSName()[0], "darwin", 6) == 0 &&
          "Unknown Darwin platform.");
-  const char *Release = &getOSName()[6];
   bool HadExtra;
-  if (!Driver::GetReleaseVersion(Release, DarwinVersion[0], DarwinVersion[1], 
+  if (!Driver::GetReleaseVersion(&getOSName()[6], 
+                                 DarwinVersion[0], DarwinVersion[1], 
                                  DarwinVersion[2], HadExtra)) {
     D.Diag(clang::diag::err_drv_invalid_darwin_version)
-      << Release;
+      << getOSName();
   }
   
   // We can only call 4.2.1 for now.