mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix recently introduced use after free.
* g10/mainproc.c (proc_plaintext): Do not use freed memory. -- GnuPG-bug-id: 4407 Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
bdda31a26b
commit
3e1f3df618
@ -946,9 +946,6 @@ proc_plaintext( CTX c, PACKET *pkt )
|
||||
if (rc)
|
||||
log_error ("handle plaintext failed: %s\n", gpg_strerror (rc));
|
||||
|
||||
free_packet (pkt, NULL);
|
||||
c->last_was_session_key = 0;
|
||||
|
||||
/* We add a marker control packet instead of the plaintext packet.
|
||||
* This is so that we can later detect invalid packet sequences.
|
||||
* The apcket is further used to convey extra data from the
|
||||
@ -974,6 +971,9 @@ proc_plaintext( CTX c, PACKET *pkt )
|
||||
extrahash[extrahashlen++] = pt->timestamp ;
|
||||
}
|
||||
|
||||
free_packet (pkt, NULL);
|
||||
c->last_was_session_key = 0;
|
||||
|
||||
n = new_kbnode (create_gpg_control (CTRLPKT_PLAINTEXT_MARK,
|
||||
extrahash, extrahashlen));
|
||||
xfree (extrahash);
|
||||
|
Loading…
x
Reference in New Issue
Block a user