Hello community, here is the log from the commit of package efivar for openSUSE:Factory checked in at 2020-09-14 12:01:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/efivar (Old) and /work/SRC/openSUSE:Factory/.efivar.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "efivar" Mon Sep 14 12:01:20 2020 rev:19 rq:833134 version:37 Changes: -------- --- /work/SRC/openSUSE:Factory/efivar/efivar.changes 2020-08-15 21:16:36.171493973 +0200 +++ /work/SRC/openSUSE:Factory/.efivar.new.4249/efivar.changes 2020-09-14 12:01:25.727508738 +0200 @@ -1,0 +2,6 @@ +Tue Sep 8 09:31:54 UTC 2020 - Gary Ching-Pang Lin <[email protected]> + +- Add efivar-bsc1175989-handle-NULL-set-variable.patch to fix + segfault in non-EFI systems (bsc#1175989) + +------------------------------------------------------------------- New: ---- efivar-bsc1175989-handle-NULL-set-variable.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ efivar.spec ++++++ --- /var/tmp/diff_new_pack.wGKdqc/_old 2020-09-14 12:01:27.051510099 +0200 +++ /var/tmp/diff_new_pack.wGKdqc/_new 2020-09-14 12:01:27.055510102 +0200 @@ -42,6 +42,7 @@ Patch2: efivar-Fix-all-the-places-Werror-address-of-packed-member-c.patch Patch3: efivar-bsc1127544-fix-ucs2len.patch Patch4: efivar-fix-efidp_ipv4_addr-fields-assignment.patch +Patch5: efivar-bsc1175989-handle-NULL-set-variable.patch %if "0%{?buildroot}" == "0" # set a sane value for buildroot, unless it's already there! BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -88,6 +89,7 @@ %patch2 -p1 %patch3 -p1 %patch4 -p1 +%patch5 -p1 %build CFLAGS="%{optflags} -Wno-nonnull -flto" ++++++ efivar-bsc1175989-handle-NULL-set-variable.patch ++++++ >From a98844ea72b04f8b0d3cc8e71089a6340e7149eb Mon Sep 17 00:00:00 2001 From: Gary Lin <[email protected]> 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 <[email protected]> --- 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
