Skip to content

Commit

Permalink
http: htp_table_get_index does not return NULL
Browse files Browse the repository at this point in the history
if the index is correct
  • Loading branch information
catenacyber authored and victorjulien committed Jun 9, 2023
1 parent 415b036 commit 14ecfeb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/app-layer-http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
5 changes: 1 addition & 4 deletions src/output-json-http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 14ecfeb

Please sign in to comment.