diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2023-05-28 18:50:46 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2023-05-28 18:54:50 +0000 |
commit | 9ed4ec4ae34a9ecab0471f1dbf392729155d7411 (patch) | |
tree | b47b4755066ec1e404c85a9aa36c8ed51bbd1f01 | |
parent | 697727110b68e483c320d834bcbcdf01c01142a1 (diff) | |
download | src-9ed4ec4ae34a9ecab0471f1dbf392729155d7411.tar.gz src-9ed4ec4ae34a9ecab0471f1dbf392729155d7411.zip |
stand: libefi: avoid a null pointer deref in eficom
We don't keep comc_port around anymore if the console's not present, but
some things might still try to set one of the environment variables we
hook. In particular, one need not even set efi_com_port/efi_com_speed
in loader.conf; loader may do it itself and induce the crash if ConOut
depicts an available uart.
Probably reported by: dch
OK for now: imp
-rw-r--r-- | stand/efi/libefi/eficom.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stand/efi/libefi/eficom.c b/stand/efi/libefi/eficom.c index 4c104114d445..f5969cc5d42a 100644 --- a/stand/efi/libefi/eficom.c +++ b/stand/efi/libefi/eficom.c @@ -497,7 +497,7 @@ comc_port_set(struct env_var *ev, int flags, const void *value) EFI_HANDLE handle; EFI_STATUS status; - if (value == NULL) + if (value == NULL || comc_port == NULL) return (CMD_ERROR); if (comc_parse_intval(value, &port) != CMD_OK) @@ -532,7 +532,7 @@ comc_speed_set(struct env_var *ev, int flags, const void *value) { unsigned speed; - if (value == NULL) + if (value == NULL || comc_port == NULL) return (CMD_ERROR); if (comc_parse_intval(value, &speed) != CMD_OK) |