]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
http: htp_table_get_index does not return NULL 9001/head
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 7 Jun 2023 14:08:14 +0000 (16:08 +0200)
committerVictor Julien <vjulien@oisf.net>
Fri, 9 Jun 2023 09:44:31 +0000 (11:44 +0200)
if the index is correct

src/app-layer-http2.c
src/output-json-http.c

index ce0cdc8c2fd01892e7f7301131909c721ed1cbb5..dd0b3ec53f932b991ce729a13e5c7c28cc75a1b7 100644 (file)
@@ -91,9 +91,7 @@ void HTTP2MimicHttp1Request(void *alstate_orig, void *h2s)
     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);
-        if (h != NULL) {
-            rs_http2_tx_add_header(h2s, bstr_ptr(h->name), bstr_len(h->name), bstr_ptr(h->value),
-                    bstr_len(h->value));
-        }
+        rs_http2_tx_add_header(
+                h2s, bstr_ptr(h->name), bstr_len(h->name), bstr_ptr(h->value), bstr_len(h->value));
     }
 }
index 30b33c74527fcb44ca80cf128ce41171094ffcb0..5f44e955573d3084e525b852052a5c76a5eae9d1 100644 (file)
@@ -321,10 +321,7 @@ static void EveHttpLogJSONHeaders(
     bool array_empty = true;
     jb_open_array(js, direction & LOG_HTTP_REQ_HEADERS ? "request_headers" : "response_headers");
     for (size_t i = 0; i < n; i++) {
-        htp_header_t * h = htp_table_get_index(headers, i, NULL);
-        if (h == NULL) {
-            continue;
-        }
+        htp_header_t *h = htp_table_get_index(headers, i, NULL);
         if ((http_ctx->flags & direction) == 0 && http_ctx->fields != 0) {
             bool tolog = false;
             for (HttpField f = HTTP_FIELD_ACCEPT; f < HTTP_FIELD_SIZE; f++) {