summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast/fa.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2026-05-01 14:38:23 +0200
committerSander Vrijders <sander@ouroboros.rocks>2026-05-20 08:17:03 +0200
commit5f0e3f8bf1710f23eaa223357e41a8595487094b (patch)
treebb4af3ab2f850f6541712dca90524e399049c16a /src/ipcpd/unicast/fa.c
parentcc6d6663956d1ed5becb1f5f3cd53d3cd899fdf0 (diff)
downloadouroboros-5f0e3f8bf1710f23eaa223357e41a8595487094b.tar.gz
ouroboros-5f0e3f8bf1710f23eaa223357e41a8595487094b.zip
ipcpd: Validate wire frame lengths
Asserting frame lengths coming from the wire was a severe flaw. Fixed by gracefully dropping runt frames. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/unicast/fa.c')
-rw-r--r--src/ipcpd/unicast/fa.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ipcpd/unicast/fa.c b/src/ipcpd/unicast/fa.c
index c157d71c..f398d317 100644
--- a/src/ipcpd/unicast/fa.c
+++ b/src/ipcpd/unicast/fa.c
@@ -528,7 +528,8 @@ static int fa_handle_flow_reply(struct fa_msg * msg,
time_t mpl = IPCP_UNICAST_MPL;
int response;
- assert(len >= sizeof(*msg));
+ if (len < sizeof(*msg))
+ return -EINVAL;
data.data = (uint8_t *) msg + sizeof(*msg);
data.len = len - sizeof(*msg);
@@ -572,8 +573,8 @@ static int fa_handle_flow_update(struct fa_msg * msg,
struct fa_flow * flow;
int fd;
- (void) len;
- assert(len >= sizeof(*msg));
+ if (len < sizeof(*msg))
+ return -EINVAL;
pthread_rwlock_wrlock(&fa.flows_lock);