Home GnuPG
Diffusion GnuPG 822c63384506

g10: Fix undefined behavior when EOF in parsing packet for S2K.

Description

g10: Fix undefined behavior when EOF in parsing packet for S2K.

* g10/parse-packet.c (parse_symkeyenc): Use iobuf_get_noeof.
(parse_key): Likewise.

Cherry picked from master commit:

1b309d9f6199a91caa0ca0b97b92d599e00b736e

When EOF comes at parsing s2k.count, it is possible the value will
be (unsigned long)-1. Then, the result of S2K_DECODE_COUNT will be
undefined. This patch fixes undefined behavior.

  • Reported-by: Philippe Antoine
  • GnuPG-bug-id: T4093
  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

Details

Provenance
gniibeAuthored on Aug 10 2018, 8:29 AM
Parents
rGf1c0d9bb6506: gpg: Set a limit for a WKD import of 256 KiB.
Branches
Unknown
Tags
Unknown
Tasks
T4093: Undefined shift in parse_symkeyenc