Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
efivar
efivar-bsc1175989-handle-NULL-set-variable.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File efivar-bsc1175989-handle-NULL-set-variable.patch of Package efivar
From a98844ea72b04f8b0d3cc8e71089a6340e7149eb Mon Sep 17 00:00:00 2001 From: Gary Lin <glin@suse.com> Date: Tue, 8 Sep 2020 17:13:02 +0800 Subject: [PATCH] Handle NULL set_variable() Add the check of NULL set_variable() to avoid segfault in a non-EFI system. Signed-off-by: Gary Lin <glin@suse.com> --- src/lib.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib.c b/src/lib.c index 107e7ef..4a0a161 100644 --- a/src/lib.c +++ b/src/lib.c @@ -33,6 +33,11 @@ _efi_set_variable(efi_guid_t guid, const char *name, uint8_t *data, size_t data_size, uint32_t attributes) { int rc; + if (!ops->set_variable) { + efi_error("set_variable() is not implemented"); + errno = ENOSYS; + return -1; + } rc = ops->set_variable(guid, name, data, data_size, attributes, 0600); if (rc < 0) efi_error("ops->set_variable() failed"); @@ -45,6 +50,11 @@ _efi_set_variable_variadic(efi_guid_t guid, const char *name, uint8_t *data, size_t data_size, uint32_t attributes, ...) { int rc; + if (!ops->set_variable) { + efi_error("set_variable() is not implemented"); + errno = ENOSYS; + return -1; + } rc = ops->set_variable(guid, name, data, data_size, attributes, 0600); if (rc < 0) efi_error("ops->set_variable() failed"); @@ -57,6 +67,11 @@ _efi_set_variable_mode(efi_guid_t guid, const char *name, uint8_t *data, size_t data_size, uint32_t attributes, mode_t mode) { int rc; + if (!ops->set_variable) { + efi_error("set_variable() is not implemented"); + errno = ENOSYS; + return -1; + } rc = ops->set_variable(guid, name, data, data_size, attributes, mode); if (rc < 0) efi_error("ops->set_variable() failed"); -- 2.28.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor