summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobhe <tobhe@cvs.openbsd.org>2021-04-03 21:29:15 +0000
committertobhe <tobhe@cvs.openbsd.org>2021-04-03 21:29:15 +0000
commitd597ac657d79619be0e9c45f6da786390af3e808 (patch)
treec2cc9d2364622bd9be022f48fa32fc0906edc33e
parentf16767e59e81e94caa4b013214ee95505a93d921 (diff)
Add size check for sockaddr mask.
-rw-r--r--sbin/iked/vroute.c4
1 files changed, 3 insertions, 1 deletions
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 <tobhe@openbsd.org>
@@ -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);