kbx: Avoid undefined behavior.

* kbx/keybox-file.c (_keybox_read_blob2): Cast to unsigned int before
shifting.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-03-07 14:25:38 +01:00
parent 7a32f87ccc
commit a68ca5a904
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ _keybox_read_blob2 (KEYBOXBLOB *r_blob, FILE *fp, int *skipped_deleted)
return gpg_error_from_syserror ();
}
imagelen = (c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4;
imagelen = ((unsigned int) c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4;
if (imagelen < 5)
return gpg_error (GPG_ERR_TOO_SHORT);