Accepting request 682663 from Base:System

OBS-URL: https://build.opensuse.org/request/show/682663
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/efivar?expand=0&rev=17
This commit is contained in:
Dominique Leuenberger 2019-03-12 08:47:49 +00:00 committed by Git OBS Bridge
commit 56d82d85c3
4 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,67 @@
From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 5 Mar 2019 17:23:24 +0100
Subject: [PATCH 1/2] ucs2.h: remove unused variable
The const uint16_t pointer is not used since now the two bytes of the
UCS-2 chars are checked to know if is the termination of the string.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
src/ucs2.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/ucs2.h b/src/ucs2.h
index edd8367..e0390c3 100644
--- a/src/ucs2.h
+++ b/src/ucs2.h
@@ -26,12 +26,11 @@ static inline size_t UNUSED
ucs2len(const void *vs, ssize_t limit)
{
ssize_t i;
- const uint16_t *s = vs;
const uint8_t *s8 = vs;
for (i = 0;
i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
- i++, s8 += 2, s++)
+ i++, s8 += 2)
;
return i;
}
--
2.20.1
From 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 5 Mar 2019 17:23:32 +0100
Subject: [PATCH 2/2] ucs2.h: fix logic that checks for UCS-2 string
termination
Currently the loop to count the lenght of the UCS-2 string ends if either
of the two bytes are 0, but 0 is a valid value for UCS-2 character codes.
So only break the loop when 0 is the value for both UCS-2 char bytes.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
src/ucs2.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ucs2.h b/src/ucs2.h
index e0390c3..fd8b056 100644
--- a/src/ucs2.h
+++ b/src/ucs2.h
@@ -29,7 +29,7 @@ ucs2len(const void *vs, ssize_t limit)
const uint8_t *s8 = vs;
for (i = 0;
- i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
+ i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0);
i++, s8 += 2)
;
return i;
--
2.20.1

View File

@ -0,0 +1,44 @@
From 836461e480e2249de134efeaef79588cab045d5c Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Tue, 5 Mar 2019 17:23:36 +0100
Subject: [PATCH] dp-message: fix efidp_ipv4_addr fields assignment
The efidp_ipv4_addr structure has some 4-byte array fields to store IPv4
addresses and network mask. But the efidp_make_ipv4() function wrongly
casts these as a char * before dereferencing them to store a value.
Instead, cast it to a uint32_t * so the 32-bit value is correctly stored.
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
src/dp-message.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/dp-message.c b/src/dp-message.c
index 6b8e907..55fa781 100644
--- a/src/dp-message.c
+++ b/src/dp-message.c
@@ -678,16 +678,16 @@ efidp_make_ipv4(uint8_t *buf, ssize_t size, uint32_t local, uint32_t remote,
EFIDP_MSG_IPv4, sizeof (*ipv4));
ssize_t req = sizeof (*ipv4);
if (size && sz == req) {
- *((char *)ipv4->local_ipv4_addr) = htonl(local);
- *((char *)ipv4->remote_ipv4_addr) = htonl(remote);
+ *((uint32_t *)ipv4->local_ipv4_addr) = htonl(local);
+ *((uint32_t *)ipv4->remote_ipv4_addr) = htonl(remote);
ipv4->local_port = htons(local_port);
ipv4->remote_port = htons(remote_port);
ipv4->protocol = htons(protocol);
ipv4->static_ip_addr = 0;
if (is_static)
ipv4->static_ip_addr = 1;
- *((char *)ipv4->gateway) = htonl(gateway);
- *((char *)ipv4->netmask) = htonl(netmask);
+ *((uint32_t *)ipv4->gateway) = htonl(gateway);
+ *((uint32_t *)ipv4->netmask) = htonl(netmask);
}
if (sz < 0)
--
2.20.1

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Mar 8 03:16:22 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
- Add efivar-bsc1127544-fix-ucs2len.patch to fix logic that checks
for UCS-2 string termination (boo#1127544)
- Add efivar-fix-efidp_ipv4_addr-fields-assignment.patch to fix the
casting of IPv4 address.
-------------------------------------------------------------------
Fri Feb 22 08:24:56 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>

View File

@ -40,6 +40,8 @@ Patch0: libefiboot-export-disk_get_partition_info.patch
Patch1: efivar-make-format_guid-handle-misaligned-guid-pointer.patch
# PATCH-FIX-UPSTREAM boo#1120862
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
%if "0%{?buildroot}" == "0"
# set a sane value for buildroot, unless it's already there!
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -84,6 +86,8 @@ perl -pi -e 's{\#include \<uchar\.h\>}{typedef __CHAR16_TYPE__ char16_t;}' \
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
CFLAGS="%{optflags} -Wno-nonnull -flto"