From 596e189798d654051bc01ecd7bfae7a364ffe448 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 27 Aug 2024 05:55:39 +0000 Subject: [PATCH] Do not send zero sized vendor or client ids. The frontend and engine do not like this due to improved error checking. Found by Josh Grosse and Renato Aguiar, thanks! --- sbin/dhcpleased/dhcpleased.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/sbin/dhcpleased/dhcpleased.c b/sbin/dhcpleased/dhcpleased.c index 0a6a7e5946a..d3ff1cefa8a 100644 --- a/sbin/dhcpleased/dhcpleased.c +++ b/sbin/dhcpleased/dhcpleased.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpleased.c,v 1.31 2024/08/25 09:53:53 florian Exp $ */ +/* $OpenBSD: dhcpleased.c,v 1.32 2024/08/27 05:55:39 florian Exp $ */ /* * Copyright (c) 2017, 2021 Florian Obser @@ -733,14 +733,18 @@ main_imsg_send_config(struct dhcpleased_conf *xconf) sizeof(*iface_conf)); main_imsg_compose_engine(IMSG_RECONF_IFACE, -1, iface_conf, sizeof(*iface_conf)); - main_imsg_compose_frontend(IMSG_RECONF_VC_ID, -1, - iface_conf->vc_id, iface_conf->vc_id_len); - main_imsg_compose_engine(IMSG_RECONF_VC_ID, -1, - iface_conf->vc_id, iface_conf->vc_id_len); - main_imsg_compose_frontend(IMSG_RECONF_C_ID, -1, - iface_conf->c_id, iface_conf->c_id_len); - main_imsg_compose_engine(IMSG_RECONF_C_ID, -1, - iface_conf->c_id, iface_conf->c_id_len); + if (iface_conf->vc_id_len) { + main_imsg_compose_frontend(IMSG_RECONF_VC_ID, -1, + iface_conf->vc_id, iface_conf->vc_id_len); + main_imsg_compose_engine(IMSG_RECONF_VC_ID, -1, + iface_conf->vc_id, iface_conf->vc_id_len); + } + if (iface_conf->c_id_len) { + main_imsg_compose_frontend(IMSG_RECONF_C_ID, -1, + iface_conf->c_id, iface_conf->c_id_len); + main_imsg_compose_engine(IMSG_RECONF_C_ID, -1, + iface_conf->c_id, iface_conf->c_id_len); + } if (iface_conf->h_name != NULL) main_imsg_compose_frontend(IMSG_RECONF_H_NAME, -1, iface_conf->h_name, strlen(iface_conf->h_name) + 1); -- 2.20.1