]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#10401 liblber: fix shift of negative int in ber_decode_int()
authorHoward Chu <hyc@openldap.org>
Thu, 16 Oct 2025 16:25:14 +0000 (17:25 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 4 Nov 2025 15:49:23 +0000 (15:49 +0000)
There's no actual possibility of overflow but sanitizers will complain.

libraries/liblber/decode.c

index 1bc897d9b911bb829f1bf0d7f7f4c90e92fb65d9..4bb095c4fca4fcf6cfccf0d1f9050fd0185e6c85 100644 (file)
@@ -313,7 +313,7 @@ ber_decode_int( const struct berval *bv, ber_int_t *num )
 
                /* shift in the bytes */
                for( i = 1; i < len; i++ ) {
-                       netnum = (netnum << 8 ) | buf[i];
+                       netnum = ((unsigned)netnum << 8 ) | buf[i];
                }
 
                *num = netnum;