From: tobhe Date: Sat, 3 Apr 2021 21:29:14 +0000 (+0000) Subject: Add size check for sockaddr mask. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d931af1f36d6a3a395265fc8898ac1f2c2baf448;p=openbsd Add size check for sockaddr mask. --- 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);