summaryrefslogtreecommitdiff
path: root/gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp')
-rw-r--r--gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp b/gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp
index 149073444c9..73470b527ee 100644
--- a/gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp
+++ b/gnu/llvm/lib/Fuzzer/test/SingleStrcmpTest.cpp
@@ -2,20 +2,16 @@
// License. See LICENSE.TXT for details.
// Simple test for a fuzzer. The fuzzer must find a particular string.
+#include <cstring>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
-#include <cstring>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
- if (Size >= 7) {
- char Copy[7];
- memcpy(Copy, Data, 6);
- Copy[6] = 0;
- if (!strcmp(Copy, "qwerty")) {
- fprintf(stderr, "BINGO\n");
- exit(1);
- }
+ char *S = (char*)Data;
+ if (Size >= 7 && !strcmp(S, "qwerty")) {
+ fprintf(stderr, "BINGO\n");
+ exit(1);
}
return 0;
}