Skip to content

Commit

Permalink
test curl NULL deref patch 2
Browse files Browse the repository at this point in the history
  • Loading branch information
vszakats committed Oct 10, 2023
1 parent eb9bb03 commit 6d09322
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions curl.test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/lib/http2.c b/lib/http2.c
index c8b059498..04dee198c 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -2062,10 +2062,18 @@ static ssize_t h2_submit(struct stream_ctx **pstream,

for(i = 0; i < nheader; ++i) {
struct dynhds_entry *e = Curl_dynhds_getn(&h2_headers, i);
- nva[i].name = (unsigned char *)e->name;
- nva[i].namelen = e->namelen;
- nva[i].value = (unsigned char *)e->value;
- nva[i].valuelen = e->valuelen;
+ if(e) {
+ nva[i].name = (unsigned char *)e->name;
+ nva[i].namelen = e->namelen;
+ nva[i].value = (unsigned char *)e->value;
+ nva[i].valuelen = e->valuelen;
+ }
+ else {
+ nva[i].name = NULL;
+ nva[i].namelen = 0;
+ nva[i].value = NULL;
+ nva[i].valuelen = 0;
+ }
nva[i].flags = NGHTTP2_NV_FLAG_NONE;
}

0 comments on commit 6d09322

Please sign in to comment.