From: Rafael Sadowski Subject: httpd: read filename via ibuf_get_string To: tech@openbsd.org Date: Fri, 18 Sep 2026 18:03:38 +0200 Would like to get rid of IMSG_DATA_SIZE, OK? commit 84b3ba5a8b795e6db03dc00f43fa53ffeffb25e8 Author: Rafael Sadowski Date: Fri Sep 18 18:02:53 2026 +0200 httpd: read filename via ibuf_get_string diff --git a/httpd.c b/httpd.c index af74ffb..85e67c5 100644 --- a/httpd.c +++ b/httpd.c @@ -423,10 +423,12 @@ parent_dispatch_server(int fd, struct privsep_proc *p, struct imsg *imsg) int parent_dispatch_logger(int fd, struct privsep_proc *p, struct imsg *imsg) { + struct ibuf ibuf; struct privsep *ps = p->p_ps; struct httpd *env = ps->ps_env; unsigned int v; - char *str = NULL; + char *filename = NULL; + size_t len; switch (imsg_get_type(imsg)) { case IMSG_CTL_RESET: @@ -435,10 +437,19 @@ parent_dispatch_logger(int fd, struct privsep_proc *p, struct imsg *imsg) parent_reload(env, v, NULL); break; case IMSG_CTL_RELOAD: - if (IMSG_DATA_SIZE(imsg) > 0) - str = get_string(imsg->data, IMSG_DATA_SIZE(imsg)); - parent_reload(env, CONFIG_RELOAD, str); - free(str); + if (imsg_get_ibuf(imsg, &ibuf) == -1) { + log_warn("%s: imsg_get_ibuf", __func__); + return (-1); + } + + if ((len = ibuf_size(&ibuf)) > 0) { + if ((filename = ibuf_get_string(&ibuf, len)) == NULL) { + log_warn("%s: ibuf_get_string", __func__); + return (-1); + } + } + parent_reload(env, CONFIG_RELOAD, filename); + free(filename); break; case IMSG_CTL_SHUTDOWN: parent_shutdown(env);