]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2: avoid possible null pointer dereference
authorDaniel Stenberg <daniel@haxx.se>
Tue, 11 Apr 2023 07:22:08 +0000 (09:22 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 11 Apr 2023 10:29:03 +0000 (12:29 +0200)
Reported-by: Dan Fandrich
Fixes #10920
Closes #10923

lib/http2.c

index 3c9d0a014d092ad298c079f2ef9e2baa93b7d043..127ae4394f351da29dc235374c48581088fea932 100644 (file)
@@ -219,13 +219,15 @@ static CURLcode http2_data_setup(struct Curl_cfilter *cf,
                                  struct stream_ctx **pstream)
 {
   struct cf_h2_ctx *ctx = cf->ctx;
-  struct stream_ctx *stream = H2_STREAM_CTX(data);
+  struct stream_ctx *stream;
 
   (void)cf;
+  DEBUGASSERT(data);
   if(!data->req.p.http) {
     failf(data, "initialization failure, transfer not http initialized");
     return CURLE_FAILED_INIT;
   }
+  stream = H2_STREAM_CTX(data);
   if(stream) {
     *pstream = stream;
     return CURLE_OK;