You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.6 KiB
45 lines
1.6 KiB
From 627860f1c60139b41580929a4c3a3328b579b278 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 12/63] 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 6b8e9072594..55fa7810439 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.26.2
|
|
|