[Pkg-gnupg-commit] [gnupg2] 94/205: kbx: Avoid undefined behavior.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit a68ca5a90457ac97eee4efd7fdea596d27c54697
Author: Justus Winter <justus at g10code.com>
Date:   Mon Mar 7 14:25:38 2016 +0100

    kbx: Avoid undefined behavior.
    
    * kbx/keybox-file.c (_keybox_read_blob2): Cast to unsigned int before
    shifting.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 kbx/keybox-file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kbx/keybox-file.c b/kbx/keybox-file.c
index eaf7565..59dfe0c 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);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list