From: Maxim Korotkov Date: Thu, 16 Feb 2023 17:16:19 +0000 (+0300) Subject: output: fix logic error X-Git-Tag: suricata-7.0.0-rc2~456 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c055dc370c6eb2d3c71064cd38cebe7284000f0;p=thirdparty%2Fsuricata.git output: fix logic error The logical error may have been made here. Comparison with the upper bound of the variable type does not make sense. It may be worth adding the cast of one of the multiplication operands to the 64-bit type for avoiding overflow. Found by Security Code with Svace static analyzer Bug: #5789 Signed-off-by: Maxim Korotkov --- diff --git a/src/output-tx.c b/src/output-tx.c index 25d7a03bc3..1ff82045be 100644 --- a/src/output-tx.c +++ b/src/output-tx.c @@ -119,7 +119,7 @@ int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, OutputTxLogger *t = list[alproto]; while (t->next) t = t->next; - if (t->id * 2 > UINT32_MAX) { + if (t->id * 2ULL > UINT32_MAX) { FatalError("Too many loggers registered."); } op->id = t->id * 2;