efi_loader: parameter checks simple network protocol
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Wed, 15 May 2019 21:27:43 +0000 (23:27 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sun, 19 May 2019 06:10:10 +0000 (08:10 +0200)
Check buffer pointers are not NULL as required by the UEFI 2.7 spec.

Return EFI_UNSUPPORTED instead of EFI_INVALID_PARAMETER when trying to
transmit with non-zero header_size.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_net.c

index e0e222a70bffc2a1051a04c378fd3116ddf1981d..d71c663068258be8ec909b8d81a4d8d5ba088815 100644 (file)
@@ -392,7 +392,7 @@ static efi_status_t EFIAPI efi_net_transmit
        efi_timer_check();
 
        /* Check parameters */
-       if (!this) {
+       if (!this || !buffer) {
                ret = EFI_INVALID_PARAMETER;
                goto out;
        }
@@ -408,7 +408,7 @@ static efi_status_t EFIAPI efi_net_transmit
                 * TODO: We would need to create the header
                 * if header_size != 0
                 */
-               ret = EFI_INVALID_PARAMETER;
+               ret = EFI_UNSUPPORTED;
                goto out;
        }
 
@@ -466,7 +466,7 @@ static efi_status_t EFIAPI efi_net_receive
        efi_timer_check();
 
        /* Check parameters */
-       if (!this) {
+       if (!this || !buffer || !buffer_size) {
                ret = EFI_INVALID_PARAMETER;
                goto out;
        }