gnupg/kbx
Werner Koch 5e3679ae39
kbx: Fix detection of corrupted keyblocks on 32 bit systems.
* kbx/keybox-search.c (blob_cmp_fpr): Avoid overflow in OFF+LEN
checking.
(blob_cmp_fpr_part): Ditto.
(blob_cmp_name): Ditto.
(blob_cmp_mail): Ditto.
(blob_x509_has_grip): Ditto.
(keybox_get_keyblock): Check OFF and LEN using a 64 bit var.
(keybox_get_cert): Ditto.
--

On most 32 bit systems size_t is 32 bit and thus the check

  size_t cert_off = get32 (buffer+8);
  size_t cert_len = get32 (buffer+12);
  if (cert_off+cert_len > length)
    return gpg_error (GPG_ERR_TOO_SHORT);

does not work as intended for all supplied values.  The simplest
solution here is to cast them to 64 bit.

In general it will be better to avoid size_t at all and work with
uint64_t.  We did not do this in the past because uint64_t was not
universally available.

GnuPG-bug-id: 3770
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-02-15 11:41:46 +01:00
..
ChangeLog-2011 Generate the ChangeLog from commit logs. 2011-12-01 11:09:02 +01:00
Makefile.am Remove -I option to common. 2017-03-07 20:25:54 +09:00
Manifest The keybox gets now compressed after 3 hours and ephemeral 2004-04-26 08:09:25 +00:00
kbxutil.c kbx: Simplify by removing custom memory functions. 2017-12-22 12:55:46 +01:00
keybox-blob.c Spelling fixes in docs and comments. 2017-04-28 10:06:33 +09:00
keybox-defs.h kbx: Simplify by removing custom memory functions. 2017-12-22 12:55:46 +01:00
keybox-dump.c kbx: Unify blob reading functions. 2017-04-01 11:10:47 +02:00
keybox-errors.c Nuked almost all trailing white space. 2011-02-04 12:57:53 +01:00
keybox-file.c kbx: Unify blob reading functions. 2017-04-01 11:10:47 +02:00
keybox-init.c Change all http://www.gnu.org in license notices to https:// 2016-11-05 12:02:19 +01:00
keybox-openpgp.c Spelling fixes in docs and comments. 2017-04-28 10:06:33 +09:00
keybox-search-desc.h Change all http://www.gnu.org in license notices to https:// 2016-11-05 12:02:19 +01:00
keybox-search.c kbx: Fix detection of corrupted keyblocks on 32 bit systems. 2018-02-15 11:41:46 +01:00
keybox-update.c kbx: Unify blob reading functions. 2017-04-01 11:10:47 +02:00
keybox-util.c kbx: Simplify by removing custom memory functions. 2017-12-22 12:55:46 +01:00
keybox.h kbx: Simplify by removing custom memory functions. 2017-12-22 12:55:46 +01:00
mkerrors Nuked almost all trailing white space. 2011-02-04 12:57:53 +01:00