From d597ac657d79619be0e9c45f6da786390af3e808 Mon Sep 17 00:00:00 2001 From: tobhe Date: Sat, 3 Apr 2021 21:29:15 +0000 Subject: Add size check for sockaddr mask. --- sbin/iked/vroute.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/iked/vroute.c b/sbin/iked/vroute.c index 8538edcf415..daca91deca8 100644 --- a/sbin/iked/vroute.c +++ b/sbin/iked/vroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vroute.c,v 1.7 2021/03/25 01:39:09 tobhe Exp $ */ +/* $OpenBSD: vroute.c,v 1.8 2021/04/03 21:29:14 tobhe Exp $ */ /* * Copyright (c) 2021 Tobias Heider @@ -108,6 +108,8 @@ vroute_getaddr(struct iked *env, struct imsg *imsg) ptr += addr->sa_len; left -= addr->sa_len; + if (left < sizeof(*mask)) + fatalx("bad length imsg received"); mask = (struct sockaddr *) ptr; if (mask->sa_family != af) return (-1); -- cgit v1.2.3