]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: buffer_truncate_rshift_bits() - Replace signed expression with an unsigned equiv...
authorMarco Bettini <marco.bettini@open-xchange.com>
Fri, 26 Nov 2021 13:15:07 +0000 (14:15 +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/buffer.c

index f6f3a0f9eca6a25ca5d4f048191574f93efb9a30..64255b5027eea0bf153e2e699ce87de62131f369 100644 (file)
@@ -476,7 +476,7 @@ buffer_truncate_rshift_bits(buffer_t *buf, size_t bits)
 
        if (bits > 0) {
                /* truncate it to closest byte boundary */
-               size_t bytes = ((bits + 7) & -8U)/8;
+               size_t bytes = ((bits + 7) & ~(size_t)7) / 8;
                /* remaining bits */
                bits = bits % 8;
                buffer_set_used_size(buf, I_MIN(bytes, buf->used));