Use inline functions to convert buffer data to scalars.
authorWerner Koch <wk@gnupg.org>
Wed, 11 Feb 2015 09:27:57 +0000 (10:27 +0100)
committerWerner Koch <wk@gnupg.org>
Wed, 11 Feb 2015 09:28:25 +0000 (10:28 +0100)
commit2183683bd633818dd031b090b5530951de76f392
treeaf283f4f329a140b76df6f7e83dce7ebb07aabb8
parentf0f71a721ccd7ab9e40b8b6b028b59632c0cc648
Use inline functions to convert buffer data to scalars.

* common/host2net.h (buf16_to_ulong, buf16_to_uint): New.
(buf16_to_ushort, buf16_to_u16): New.
(buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New.
--

Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to
avoid all sign extension on shift problems.  Hanno Böck found a case
with an invalid read due to this problem.  To fix that once and for
all almost all uses of "<< 24" and "<< 8" are changed by this patch to
use an inline function from host2net.h.

Signed-off-by: Werner Koch <wk@gnupg.org>
31 files changed:
agent/cvt-openpgp.c
common/b64enc.c
common/dns-cert.c
common/host2net.h
common/iobuf.c
common/pka.c
common/srv.c
common/tlv.c
dirmngr/ldap.c
g10/build-packet.c
g10/call-agent.c
g10/getkey.c
g10/keygen.c
g10/keyid.c
g10/misc.c
g10/parse-packet.c
g10/pubkey-enc.c
g10/seckey-cert.c
g10/tdbio.c
g10/trust.c
g13/mount.c
kbx/keybox-dump.c
kbx/keybox-openpgp.c
kbx/keybox-search.c
kbx/keybox-update.c
scd/apdu.c
scd/app-nks.c
scd/app-openpgp.c
scd/ccid-driver.c
sm/fingerprint.c
tools/ccidmon.c