Blame SOURCES/0012-dp-message-fix-efidp_ipv4_addr-fields-assignment.patch

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