]> git.proxmox.com Git - grub2.git/commit
net/tftp: Avoid a trivial UAF
authorDaniel Axtens <dja@axtens.net>
Tue, 18 Jan 2022 03:29:20 +0000 (14:29 +1100)
committerJulian Andres Klode <julian.klode@canonical.com>
Wed, 8 Jun 2022 10:41:03 +0000 (12:41 +0200)
commitfb66f40ba67b88408a43cb38492053985bfe4968
treeccd70cb8bdce5ba1524ef4af6b92034e31648821
parente7573be61b3cf005cdf0a068652153437daca4b3
net/tftp: Avoid a trivial UAF

Under tftp errors, we print a tftp error message from the tftp header.
However, the tftph pointer is a pointer inside nb, the netbuff. Previously,
we were freeing the nb and then dereferencing it. Don't do that, use it
and then free it later.

This isn't really _bad_ per se, especially as we're single-threaded, but
it trips up fuzzers.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/net/tftp.c