From dc44763e9eebe9c22450d0df5962d7c2abe93399 Mon Sep 17 00:00:00 2001 From: Yunshu Ouyang <61579667+yooyoo9@users.noreply.github.com> Date: Tue, 8 Sep 2020 21:07:01 +0200 Subject: [PATCH] [Nginx] fixing startup crashes (#4425) * fixing startup crashes * Removed whitespaces --- projects/nginx/build.sh | 2 +- projects/nginx/fuzz/http_request_fuzzer.cc | 1 - projects/nginx/fuzz/wrappers.c | 9 +++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/nginx/build.sh b/projects/nginx/build.sh index 341b0e5ac..fcfb70bac 100644 --- a/projects/nginx/build.sh +++ b/projects/nginx/build.sh @@ -24,7 +24,7 @@ rm -rf genfiles && mkdir genfiles && $SRC/LPM/external.protobuf/bin/protoc http_ cd ../.. auto/configure \ - --with-ld-opt="-Wl,--wrap=listen -Wl,--wrap=setsockopt -Wl,--wrap=bind -Wl,--wrap=shutdown -Wl,--wrap=connect -Wl,--wrap=getpwnam -Wl,--wrap=getgrnam" \ + --with-ld-opt="-Wl,--wrap=listen -Wl,--wrap=setsockopt -Wl,--wrap=bind -Wl,--wrap=shutdown -Wl,--wrap=connect -Wl,--wrap=getpwnam -Wl,--wrap=getgrnam -Wl,--wrap=chmod -Wl,--wrap=chown" \ --with-http_v2_module make -f objs/Makefile fuzzers diff --git a/projects/nginx/fuzz/http_request_fuzzer.cc b/projects/nginx/fuzz/http_request_fuzzer.cc index 4cb8c008b..bed04d7d0 100644 --- a/projects/nginx/fuzz/http_request_fuzzer.cc +++ b/projects/nginx/fuzz/http_request_fuzzer.cc @@ -30,7 +30,6 @@ extern "C" { #include "libprotobuf-mutator/src/libfuzzer/libfuzzer_macro.h" static char configuration[] = -"user root;\n" "error_log stderr emerg;\n" "events {\n" " use epoll;\n" diff --git a/projects/nginx/fuzz/wrappers.c b/projects/nginx/fuzz/wrappers.c index a351c37a3..213912176 100644 --- a/projects/nginx/fuzz/wrappers.c +++ b/projects/nginx/fuzz/wrappers.c @@ -15,6 +15,7 @@ //////////////////////////////////////////////////////////////////////////////// #include #include +#include #include #include @@ -35,6 +36,14 @@ int __wrap_setsockopt(int fd, int level, int optname, const void *optval, return 0; } +int __wrap_chmod(const char *pathname, mode_t mode){ + return 0; +} + +int __wrap_chown(const char *pathname, uid_t owner, gid_t group){ + return 0; +} + struct passwd *__wrap_getpwnam(const char *name){ struct passwd *pwd = (struct passwd *) calloc(1, sizeof(struct passwd)); pwd->pw_uid = 1;