From a68ca5a90457ac97eee4efd7fdea596d27c54697 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 7 Mar 2016 14:25:38 +0100 Subject: kbx: Avoid undefined behavior. * kbx/keybox-file.c (_keybox_read_blob2): Cast to unsigned int before shifting. Signed-off-by: Justus Winter --- kbx/keybox-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kbx') diff --git a/kbx/keybox-file.c b/kbx/keybox-file.c index eaf756546..59dfe0c3e 100644 --- a/kbx/keybox-file.c +++ b/kbx/keybox-file.c @@ -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); -- cgit v1.2.3