iPXE - Open Source Boot Firmware

[efi] Check buffer length for packets retrieved via our SNP protocol
authorMichael Brown <mcb30@ipxe.org>
Wed, 6 Sep 2017 22:18:29 +0000 (23:18 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 6 Sep 2017 22:28:21 +0000 (23:28 +0100)
commit3f429bdcfe0c3698f886e93a1f603656ccaa0f28
treec68f71887170586c36c84e5e68e76f68a53c0372
parent9faf069126b37cef87a47209b661de434d9e71cf
[efi] Check buffer length for packets retrieved via our SNP protocol

We do not currently check the length of the caller's buffer for
received packets.  This creates a potential buffer overrun when iPXE
is being used via the SNP or UNDI protocols.

Fix by checking the buffer length and correctly returning the required
length and an EFI_BUFFER_TOO_SMALL error.

Reported-by: Paul McMillan <paul.mcmillan@oracle.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_snp.c