]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http2: null check during upgrade 6465/head
authorPhilippe Antoine <contact@catenacyber.fr>
Mon, 23 Aug 2021 13:03:51 +0000 (15:03 +0200)
committerVictor Julien <victor@inliniac.net>
Sat, 9 Oct 2021 14:15:23 +0000 (16:15 +0200)
(cherry picked from commit fa4c7626bde98f20700172984f7bd07c285406ba)

src/app-layer-http2.c

index 6285be9dd9d47f51e0373bc732da8b0010f89f24..d83537f7f96b895195908d2396671b501d19c453 100644 (file)
@@ -81,9 +81,13 @@ void HTTP2MimicHttp1Request(void *alstate_orig, void *h2s)
         // may happen if we only got the reply, not the HTTP1 request
         return;
     }
-
+    // else
     rs_http2_tx_set_method(h2s, bstr_ptr(h1tx->request_method), bstr_len(h1tx->request_method));
-    rs_http2_tx_set_uri(h2s, bstr_ptr(h1tx->request_uri), bstr_len(h1tx->request_uri));
+    if (h1tx->request_uri != NULL) {
+        // A request line without spaces gets interpreted as a request_method
+        // and has request_uri=NULL
+        rs_http2_tx_set_uri(h2s, bstr_ptr(h1tx->request_uri), bstr_len(h1tx->request_uri));
+    }
     size_t nbheaders = htp_table_size(h1tx->request_headers);
     for (size_t i = 0; i < nbheaders; i++) {
         htp_header_t *h = htp_table_get_index(h1tx->request_headers, i, NULL);