summaryrefslogtreecommitdiffhomepage
path: root/fuzzing/nxt_http_h1p_peer_fuzz.c
diff options
context:
space:
mode:
authorArjun <pkillarjun@protonmail.com>2024-08-07 15:08:46 +0530
committerAndrew Clayton <a.clayton@nginx.com>2024-08-26 15:18:12 +0100
commit719207693ef42953e50b1422c59fafc497320d41 (patch)
tree42481bfddd7247abf0961a40886d04424f6e3955 /fuzzing/nxt_http_h1p_peer_fuzz.c
parentcff18f898f58786bc003dbe2921bc0197cc58887 (diff)
downloadunit-719207693ef42953e50b1422c59fafc497320d41.tar.gz
unit-719207693ef42953e50b1422c59fafc497320d41.tar.bz2
fuzzing: fixed harness bug
False positive bug in harness due to improper use of the internal API. Fixes: a93d878 ("fuzzing: add fuzzing targets") Signed-off-by: Arjun <pkillarjun@protonmail.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to '')
-rw-r--r--fuzzing/nxt_http_h1p_peer_fuzz.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fuzzing/nxt_http_h1p_peer_fuzz.c b/fuzzing/nxt_http_h1p_peer_fuzz.c
index 54876658..43786d0c 100644
--- a/fuzzing/nxt_http_h1p_peer_fuzz.c
+++ b/fuzzing/nxt_http_h1p_peer_fuzz.c
@@ -62,6 +62,16 @@ LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
goto failed;
}
+ req->peer = nxt_mp_zalloc(mp, sizeof(nxt_http_peer_t));
+ if (req->peer == NULL) {
+ goto failed;
+ }
+
+ req->peer->proto.h1 = nxt_mp_zalloc(mp, sizeof(nxt_h1proto_t));
+ if (req->peer->proto.h1 == NULL) {
+ goto failed;
+ }
+
buf.start = (u_char *)data;
buf.end = (u_char *)data + size;
buf.pos = buf.start;