mirror of
git://git.gnupg.org/gnupg.git
synced 2025-06-14 18:31:03 +02:00
common: Don't incorrectly copy packets with partial lengths.
* g10/parse-packet.c (parse): We don't handle copying packets with a partial body length to an output stream. If this occurs, log an error and abort. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
parent
0143d5c1ca
commit
b3226cadf9
@ -654,6 +654,17 @@ parse (IOBUF inp, PACKET * pkt, int onlykeypkts, off_t * retpos,
|
|||||||
|
|
||||||
if (out && pkttype)
|
if (out && pkttype)
|
||||||
{
|
{
|
||||||
|
/* This type of copying won't work if the packet uses a partial
|
||||||
|
body length. (In other words, this only works if HDR is
|
||||||
|
actually the length.) Currently, no callers require this
|
||||||
|
functionality so we just log this as an error. */
|
||||||
|
if (partial)
|
||||||
|
{
|
||||||
|
log_error ("parse: Can't copy partial packet. Aborting.\n");
|
||||||
|
rc = gpg_error (GPG_ERR_INV_PACKET);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
rc = iobuf_write (out, hdr, hdrlen);
|
rc = iobuf_write (out, hdr, hdrlen);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc = copy_packet (inp, out, pkttype, pktlen, partial);
|
rc = copy_packet (inp, out, pkttype, pktlen, partial);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user