]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: str_parse_intmax() - Replace signed expression with UNSIGNED_MINUS()
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 26 Nov 2021 13:45:47 +0000 (14:45 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 30 Nov 2021 10:03:03 +0000 (10:03 +0000)
Found by code analysis tool

src/lib/strnum.c

index fe1bdbca63e3d59521cc4ff942a197f93c7c99f7..4b3da4a5f906e603c03e1697f2a28f555f88da42 100644 (file)
@@ -334,7 +334,7 @@ str_parse_intmax(const char *str, intmax_t *num_r, const char **endp_r)
        } else {
                if (l > UINTMAX_MAX - (UINTMAX_MAX + INTMAX_MIN))
                        return -1;
-               *num_r = (intmax_t)-l;
+               *num_r = (intmax_t) UNSIGNED_MINUS(l);
        }
        return 0;
 }