http: error check htp_list_size

This avoids a potential casting to uint64_t of -1, leading to a very
high upper bound of the tx loop.
pull/5464/head
Victor Julien 6 years ago
parent 6f9b7e052a
commit e07a4393a9

@ -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;
}

Loading…
Cancel
Save