summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-01-05 00:03:17 +0100
committerSander Vrijders <sander@ouroboros.rocks>2026-01-07 08:37:30 +0100
commit145be13e8c18fcb39476d8f65fed23d82320f22f (patch)
tree9eca55029ebd5c181dfe0d2a886a4dc17aea205e /src/ipcpd
parent512004f0a2a4a4a9b95312505202af8a7872873b (diff)
downloadouroboros-145be13e8c18fcb39476d8f65fed23d82320f22f.tar.gz
ouroboros-145be13e8c18fcb39476d8f65fed23d82320f22f.zip
ipcpd: Initialize mgmt frames in eth/udp
The eth and udp layer management frames/packets contain some unused fields which were not cleared after malloc. In a future update, the unused fields will be removed from the packets, but for now, we can just zero these after malloc. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd')
-rw-r--r--src/ipcpd/eth/eth.c8
-rw-r--r--src/ipcpd/udp/udp.c4
2 files changed, 12 insertions, 0 deletions
diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c
index 0b6a91fb..d2e7a7c8 100644
--- a/src/ipcpd/eth/eth.c
+++ b/src/ipcpd/eth/eth.c
@@ -474,6 +474,8 @@ static int eth_ipcp_alloc(const uint8_t * dst_addr,
if (buf == NULL)
return -1;
+ memset(buf, 0, len + ETH_HEADER_TOT_SIZE + data->len);
+
msg = (struct mgmt_msg *) (buf + ETH_HEADER_TOT_SIZE);
msg->code = FLOW_REQ;
#if defined(BUILD_ETH_DIX)
@@ -526,6 +528,8 @@ static int eth_ipcp_alloc_resp(uint8_t * dst_addr,
if (buf == NULL)
return -1;
+ memset(buf, 0, sizeof(*msg) + ETH_HEADER_TOT_SIZE + data->len);
+
msg = (struct mgmt_msg *) (buf + ETH_HEADER_TOT_SIZE);
msg->code = FLOW_REPLY;
@@ -664,6 +668,8 @@ static int eth_ipcp_name_query_req(const uint8_t * hash,
if (buf == NULL)
return -1;
+ memset(buf, 0, len + ETH_HEADER_TOT_SIZE);
+
msg = (struct mgmt_msg *) (buf + ETH_HEADER_TOT_SIZE);
msg->code = NAME_QUERY_REPLY;
@@ -1650,6 +1656,8 @@ static int eth_ipcp_query(const uint8_t * hash)
if (buf == NULL)
return -1;
+ memset(buf, 0, len + ETH_HEADER_TOT_SIZE);
+
msg = (struct mgmt_msg *) (buf + ETH_HEADER_TOT_SIZE);
msg->code = NAME_QUERY_REQ;
diff --git a/src/ipcpd/udp/udp.c b/src/ipcpd/udp/udp.c
index be8069a4..d8b5b4cd 100644
--- a/src/ipcpd/udp/udp.c
+++ b/src/ipcpd/udp/udp.c
@@ -208,6 +208,8 @@ static int udp_ipcp_port_alloc(const struct __SOCKADDR * r_saddr,
if (buf == NULL)
return -1;
+ memset(buf, 0, len + data->len);
+
msg = (struct mgmt_msg *) buf;
msg->eid = hton32(MGMT_EID);
msg->code = FLOW_REQ;
@@ -251,6 +253,8 @@ static int udp_ipcp_port_alloc_resp(const struct __SOCKADDR * r_saddr,
if (msg == NULL)
return -1;
+ memset(msg, 0, sizeof(*msg) + data->len);
+
msg->eid = hton32(MGMT_EID);
msg->code = FLOW_REPLY;
msg->s_eid = hton32(s_eid);