]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
output: fix logic error
authorMaxim Korotkov <korotkov.maxim.s@gmail.com>
Thu, 16 Feb 2023 17:16:19 +0000 (20:16 +0300)
committerVictor Julien <vjulien@oisf.net>
Mon, 3 Apr 2023 19:18:57 +0000 (21:18 +0200)
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 <m.korotkov@securitycode.ru>
src/output-tx.c

index 25d7a03bc3135af74baec7e67d85b519527bfad7..1ff82045bede9344eec77c8b849967561f840214 100644 (file)
@@ -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;