mirror of
https://github.com/ipxe/ipxe
synced 2026-10-07 15:05:42 +03:00
[crypto] Remove harmless but technically undefined left shift
The unsigned 8-bit value from the keyUsage bit string is promoted to a (signed) int before being shifted left by up to 24 bits, which is technically undefined behaviour. Explicitly cast the 8-bit value to an unsigned int before shifting, to inhibit this class of false positive warning. There is no difference to the resulting object code. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+1
-1
@@ -524,7 +524,7 @@ static int x509_parse_key_usage ( struct x509_certificate *cert,
|
||||
if ( len > sizeof ( usage->bits ) )
|
||||
len = sizeof ( usage->bits );
|
||||
for ( i = 0 ; i < len ; i++ ) {
|
||||
usage->bits |= ( *(bytes++) << ( 8 * i ) );
|
||||
usage->bits |= ( ( ( unsigned ) *(bytes++) ) << ( 8 * i ) );
|
||||
}
|
||||
DBGC2 ( cert, "X509 %p key usage is %08x\n", cert, usage->bits );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user