From 117cf65030f35667232e53cca32271a3313c04ce Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Thu, 25 Jun 2026 18:21:14 +0200 Subject: [PATCH] forecast: Fix undefined shift if traffic selector is /0 Not an issue in typical scenarios where the plugin is used on a gateway with roadwarriors that use /32 addresses. But could be an issue if used on a client that tunnels everything to the gateway. Fixes: e5ad2e66146c ("forecast: Add the broadcast/multicast forwarding plugin called forecast") --- src/libcharon/plugins/forecast/forecast_listener.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcharon/plugins/forecast/forecast_listener.c b/src/libcharon/plugins/forecast/forecast_listener.c index 3d000bc48..b70945717 100644 --- a/src/libcharon/plugins/forecast/forecast_listener.c +++ b/src/libcharon/plugins/forecast/forecast_listener.c @@ -122,7 +122,7 @@ static bool ts2in(traffic_selector_t *ts, { memcpy(&addr->s_addr, net->get_address(net).ptr, 4); net->destroy(net); - mask->s_addr = htonl(0xffffffffU << (32 - bits)); + mask->s_addr = bits ? htonl(0xffffffffU << (32 - bits)) : 0; return TRUE; } return FALSE;