summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhipeng Xue <543984341@qq.com>2023-03-05 05:13:54 +0800
committerGitHub <noreply@github.com>2023-03-04 22:13:54 +0100
commitbac9d10a6d67ea8440b00b58b328114438586664 (patch)
tree3fe001c0201706679b24732ffdf38486de2a1bba
parentfa05966d74810ed1bc5c3f0ace83ba31b9225735 (diff)
downloadlibevent-bac9d10a6d67ea8440b00b58b328114438586664.tar.gz
Fix potential null dereference in http-server (#1430)
Co-authored-by: Azat Khuzhin <a3at.mail@gmail.com>
-rw-r--r--sample/http-server.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sample/http-server.c b/sample/http-server.c
index b006891e..38a34623 100644
--- a/sample/http-server.c
+++ b/sample/http-server.c
@@ -258,6 +258,8 @@ send_document_cb(struct evhttp_request *req, void *arg)
#ifdef _WIN32
dirlen = strlen(whole_path);
pattern = malloc(dirlen+3);
+ if (!pattern)
+ goto err;
memcpy(pattern, whole_path, dirlen);
pattern[dirlen] = '\\';
pattern[dirlen+1] = '*';