[asan] Fix filename size on linux platforms.
authorYvan Roux <yvan.roux@linaro.org>
Wed, 7 Feb 2018 18:27:25 +0000 (18:27 +0000)
committerYvan Roux <yvan.roux@linaro.org>
Wed, 7 Feb 2018 18:27:25 +0000 (18:27 +0000)
This is a a fix for:
https://bugs.llvm.org/show_bug.cgi?id=35996

Use filename limits from system headers to be synchronized with what
LD_PRELOAD can handle.

Differential Revision: https://reviews.llvm.org/D42900

llvm-svn: 324496

compiler-rt/lib/asan/asan_linux.cc

index 047e1dbb72fa903924e9f64089eb3398343ba2cd..625f32d408dfacfc11471024a2497f23fdfcf1b6 100644 (file)
@@ -32,6 +32,7 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <fcntl.h>
+#include <limits.h>
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -214,7 +215,7 @@ void AsanCheckIncompatibleRT() {
       // the functions in dynamic ASan runtime instead of the functions in
       // system libraries, causing crashes later in ASan initialization.
       MemoryMappingLayout proc_maps(/*cache_enabled*/true);
-      char filename[128];
+      char filename[PATH_MAX];
       MemoryMappedSegment segment(filename, sizeof(filename));
       while (proc_maps.Next(&segment)) {
         if (IsDynamicRTName(segment.filename)) {