diff options
author | pamela <pamela@cvs.openbsd.org> | 2019-03-11 22:53:30 +0000 |
---|---|---|
committer | pamela <pamela@cvs.openbsd.org> | 2019-03-11 22:53:30 +0000 |
commit | e88d185d3f08f1f452c697f036281f98651ca59a (patch) | |
tree | 9aaf3a9e18d745667784352e56b5f823a12b7b35 /sbin/slaacd/frontend.c | |
parent | 1edb16b7df21b014a793d7c4703488ba73b57cbe (diff) |
Make slaacd(8) imsg processing more paranoid. Unexpected size mismatches
mean we should no longer trust processes, so we call fatal(x). The
control socket is the exception, where we ignore rather than allow
crashes due to data from the outside.
suggestion/input and OK florian@
Diffstat (limited to 'sbin/slaacd/frontend.c')
-rw-r--r-- | sbin/slaacd/frontend.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/slaacd/frontend.c b/sbin/slaacd/frontend.c index 7b5b1440661..9750e33ac60 100644 --- a/sbin/slaacd/frontend.c +++ b/sbin/slaacd/frontend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frontend.c,v 1.24 2019/03/11 14:51:20 florian Exp $ */ +/* $OpenBSD: frontend.c,v 1.25 2019/03/11 22:53:29 pamela Exp $ */ /* * Copyright (c) 2017 Florian Obser <florian@openbsd.org> @@ -426,10 +426,18 @@ frontend_dispatch_engine(int fd, short event, void *bula) break; #endif /* SMALL */ case IMSG_CTL_SEND_SOLICITATION: + if (IMSG_DATA_SIZE(imsg) != sizeof(if_index)) + fatalx("%s: IMSG_CTL_SEND_SOLICITATION wrong " + "length: %lu", __func__, + IMSG_DATA_SIZE(imsg)); if_index = *((uint32_t *)imsg.data); send_solicitation(if_index); break; case IMSG_FAKE_ACK: + if (IMSG_DATA_SIZE(imsg) != sizeof(struct + imsg_proposal_ack)) + fatalx("%s: IMSG_FAKE_ACK wrong length: %lu", + __func__, IMSG_DATA_SIZE(imsg)); frontend_imsg_compose_engine(IMSG_PROPOSAL_ACK, 0, 0, imsg.data, sizeof(struct imsg_proposal_ack)); break; |