Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: httpd: use imsg_get_data to read ctl_flags
To:
Rafael Sadowski <rafael@sizeofvoid.org>
Cc:
tech@openbsd.org
Date:
Sat, 19 Sep 2026 09:53:30 +0200

Download raw body.

Thread
On Fri, Sep 18, 2026 at 11:10:46PM +0200, Rafael Sadowski wrote:
> Simplify imsg handling by using imsg_get_data. I don't understand why we
> should ignore the error here. It was here since the beginning.

Normally you would ignore such errors only when the messages arrive via
control socket. I doubt this is the case here.

OK claudio@
 
> commit 818498aa26f5c8db914b75e4a608257f03356761
> Author: Rafael Sadowski <rafael@sizeofvoid.org>
> Date:   Fri Sep 18 22:56:31 2026 +0200
> 
>     httpd: use imsg_get_data to read ctl_flags
> 
> diff --git a/config.c b/config.c
> index d043ee8..371fc48 100644
> --- a/config.c
> +++ b/config.c
> @@ -143,11 +143,10 @@ config_getcfg(struct httpd *env, struct imsg *imsg)
>  {
>  	struct ctl_flags	 cf;
>  
> -	if (IMSG_DATA_SIZE(imsg) != sizeof(cf))
> -		return (0); /* ignore */
> +	if (imsg_get_data(imsg, &cf, sizeof(cf)) == -1)
> +		fatalx("%s: imsg_get_data", __func__);
>  
>  	/* Update runtime flags */
> -	memcpy(&cf, imsg->data, sizeof(cf));
>  	env->sc_opts = cf.cf_opts;
>  	env->sc_flags = cf.cf_flags;
>  	memcpy(env->sc_tls_sid, cf.cf_tls_sid, sizeof(env->sc_tls_sid));
> 

-- 
:wq Claudio