Skip to content

Commit

Permalink
http: error check htp_list_size
Browse files Browse the repository at this point in the history
This avoids a potential casting to uint64_t of -1, leading to a very
high upper bound of the tx loop.
  • Loading branch information
victorjulien committed Oct 5, 2020
1 parent 6f9b7e0 commit e07a439
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/app-layer-htp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2947,9 +2947,11 @@ static uint64_t HTPStateGetTxCnt(void *alstate)
HtpState *http_state = (HtpState *)alstate;

if (http_state != NULL && http_state->conn != NULL) {
const uint64_t size = (uint64_t)htp_list_size(http_state->conn->transactions);
const int64_t size = (int64_t)htp_list_size(http_state->conn->transactions);
if (size < 0)
return 0ULL;
SCLogDebug("size %"PRIu64, size);
return size;
return (uint64_t)size;
} else {
return 0ULL;
}
Expand Down

0 comments on commit e07a439

Please sign in to comment.