From: Philippe Antoine Date: Wed, 7 Jun 2023 14:08:14 +0000 (+0200) Subject: http: htp_table_get_index does not return NULL X-Git-Tag: suricata-7.0.0-rc2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F9001%2Fhead;p=thirdparty%2Fsuricata.git http: htp_table_get_index does not return NULL if the index is correct --- diff --git a/src/app-layer-http2.c b/src/app-layer-http2.c index ce0cdc8c2f..dd0b3ec53f 100644 --- a/src/app-layer-http2.c +++ b/src/app-layer-http2.c @@ -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)); } } diff --git a/src/output-json-http.c b/src/output-json-http.c index 30b33c7452..5f44e95557 100644 --- a/src/output-json-http.c +++ b/src/output-json-http.c @@ -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++) {