mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Avoid sign extension when shifting the MSB.
* sm/fingerprint.c (gpgsm_get_short_fingerprint): Cast MSB before shifting. * g10/build-packet.c (delete_sig_subpkt): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
46fa1e0fe9
commit
91b826a388
@ -618,8 +618,10 @@ delete_sig_subpkt (subpktarea_t *area, sigsubpkttype_t reqtype )
|
||||
if( n == 255 ) {
|
||||
if( buflen < 4 )
|
||||
break;
|
||||
n = (buffer[0] << 24) | (buffer[1] << 16)
|
||||
| (buffer[2] << 8) | buffer[3];
|
||||
n = (((size_t)buffer[0] << 24)
|
||||
| (buffer[1] << 16)
|
||||
| (buffer[2] << 8)
|
||||
| buffer[3]);
|
||||
buffer += 4;
|
||||
buflen -= 4;
|
||||
}
|
||||
|
@ -149,8 +149,14 @@ gpgsm_get_short_fingerprint (ksba_cert_t cert, unsigned long *r_high)
|
||||
|
||||
gpgsm_get_fingerprint (cert, GCRY_MD_SHA1, digest, NULL);
|
||||
if (r_high)
|
||||
*r_high = ((digest[12]<<24)|(digest[13]<<16)|(digest[14]<< 8)|digest[15]);
|
||||
return ((digest[16]<<24)|(digest[17]<<16)|(digest[18]<< 8)|digest[19]);
|
||||
*r_high = (((unsigned long)digest[12]<<24)
|
||||
|(digest[13]<<16)
|
||||
|(digest[14]<< 8)
|
||||
|digest[15]);
|
||||
return (((unsigned long)digest[16]<<24)
|
||||
|(digest[17]<<16)
|
||||
|(digest[18]<<8)
|
||||
|digest[19]);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user