git: 9ed4ec4ae34a - main - stand: libefi: avoid a null pointer deref in eficom
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 28 May 2023 18:55:25 UTC
The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9ed4ec4ae34a9ecab0471f1dbf392729155d7411 commit 9ed4ec4ae34a9ecab0471f1dbf392729155d7411 Author: Kyle Evans <kevans@FreeBSD.org> AuthorDate: 2023-05-28 18:50:46 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2023-05-28 18:54:50 +0000 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 --- stand/efi/libefi/eficom.c | 4 ++-- 1 file 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)