From 429ed54a3daee0e8758109b8ed86ca9ca735789c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 23 Feb 2019 18:43:38 +0200 Subject: [PATCH] UBSan: Avoid a warning on signed left shift Use unsigned 1 (1U) instead of signed (1) when doing left shift that could potentially need to use all bits of the 32-bit unsigned variable. radius_server.c:2254:14: runtime error: left shift of 1 by 31 places cannot be represented in type 'int' Signed-off-by: Jouni Malinen --- src/radius/radius_server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/radius/radius_server.c b/src/radius/radius_server.c index aa78cbae6..1c15c2c3f 100644 --- a/src/radius/radius_server.c +++ b/src/radius/radius_server.c @@ -1,6 +1,6 @@ /* * RADIUS authentication server - * Copyright (c) 2005-2009, 2011-2014, Jouni Malinen + * Copyright (c) 2005-2009, 2011-2019, Jouni Malinen * * This software may be distributed under the terms of the BSD license. * See README for more details. @@ -2251,7 +2251,7 @@ radius_server_read_clients(const char *client_file, int ipv6) entry->addr.s_addr = addr.s_addr; val = 0; for (i = 0; i < mask; i++) - val |= 1 << (31 - i); + val |= 1U << (31 - i); entry->mask.s_addr = htonl(val); } #ifdef CONFIG_IPV6 -- 2.47.2