[PATCH] D15181: [sanitizer] Replace a local array with InternalScopedString in MaybeReexec()

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 09:08:37 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL254619: [sanitizer] Replace a local array with InternalScopedString in MaybeReexec() (authored by kuba.brecka).

Changed prior to commit:
  http://reviews.llvm.org/D15181?vs=41732&id=41765#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15181

Files:
  compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc

Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_mac.cc
@@ -566,9 +566,9 @@
   if (DyldNeedsEnvVariable() && !lib_is_in_env) {
     // DYLD_INSERT_LIBRARIES is not set or does not contain the runtime
     // library.
-    char program_name[1024];
-    uint32_t buf_size = sizeof(program_name);
-    _NSGetExecutablePath(program_name, &buf_size);
+    InternalScopedString program_name(1024);
+    uint32_t buf_size = program_name.size();
+    _NSGetExecutablePath(program_name.data(), &buf_size);
     char *new_env = const_cast<char*>(info.dli_fname);
     if (dyld_insert_libraries) {
       // Append the runtime dylib name to the existing value of
@@ -589,7 +589,7 @@
     VReport(1, "exec()-ing the program with\n");
     VReport(1, "%s=%s\n", kDyldInsertLibraries, new_env);
     VReport(1, "to enable wrappers.\n");
-    execv(program_name, *_NSGetArgv());
+    execv(program_name.data(), *_NSGetArgv());
 
     // We get here only if execv() failed.
     Report("ERROR: The process is launched without DYLD_INSERT_LIBRARIES, "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15181.41765.patch
Type: text/x-patch
Size: 1230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151203/f9095011/attachment.bin>


More information about the llvm-commits mailing list