summaryrefslogtreecommitdiffstats
path: root/kbx
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-03-07 14:25:38 +0100
committerJustus Winter <justus@g10code.com>2016-03-07 14:38:11 +0100
commita68ca5a90457ac97eee4efd7fdea596d27c54697 (patch)
treeb74b76c48d449801b8b38fce48c093d7b08929ab /kbx
parentscd: Bug fix for a device with multiple interfaces. (diff)
downloadgnupg2-a68ca5a90457ac97eee4efd7fdea596d27c54697.tar.xz
gnupg2-a68ca5a90457ac97eee4efd7fdea596d27c54697.zip
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>
Diffstat (limited to 'kbx')
-rw-r--r--kbx/keybox-file.c2
1 files changed, 1 insertions, 1 deletions
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);