diff options
| author | Jeff King <peff@peff.net> | 2019-08-25 03:19:51 -0400 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2019-08-26 10:29:56 -0700 |
| commit | 60fe477a0be2a3801e5ce3913e0be8e8e2e58e4f (patch) | |
| tree | 3233bf20b5adeb58359de561a7a57b3432bfe146 /commit.c | |
| parent | notes: avoid leaking duplicate entries (diff) | |
| download | git-60fe477a0be2a3801e5ce3913e0be8e8e2e58e4f.tar.gz git-60fe477a0be2a3801e5ce3913e0be8e8e2e58e4f.zip | |
notes: avoid potential use-after-free during insertion
The note_tree_insert() function may free the leaf_node struct we pass in
(e.g., if it's a duplicate, or if it needs to be combined with an
existing note).
Most callers are happy with this, as they assume that ownership of the
struct is handed off. But in load_subtree(), if we see an error we'll
use the handed-off struct's key_oid to generate the die() message,
potentially accessing freed memory.
We can easily fix this by instead using the original oid that we copied
into the leaf_node struct.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions
