From 6795f26af554ad58aaca056db03657653b2e4e60 Mon Sep 17 00:00:00 2001 From: George Karpenkov <ekarpenkov@apple.com> Date: Wed, 2 Aug 2017 21:38:50 +0000 Subject: [PATCH] [libFuzzer tests] Use substring comparison in libFuzzer tests LIT launches executables with absolute, and not relative, path. strncmp would try to do exact comparison and fail. Differential Revision: https://reviews.llvm.org/D36242 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309889 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Fuzzer/test/InitializeTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Fuzzer/test/InitializeTest.cpp b/lib/Fuzzer/test/InitializeTest.cpp index 0d6a0fda093..df1117c1ec5 100644 --- a/lib/Fuzzer/test/InitializeTest.cpp +++ b/lib/Fuzzer/test/InitializeTest.cpp @@ -20,7 +20,7 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { if (Size == strlen(argv0) && - !strncmp(reinterpret_cast<const char *>(Data), argv0, Size)) { + !strnstr(reinterpret_cast<const char *>(Data), argv0, Size)) { fprintf(stderr, "BINGO %s\n", argv0); exit(1); }