From 89eb00e967b3fa70db9571edf59c6f783df78dd4 Mon Sep 17 00:00:00 2001 From: Daniel Hajjar Date: Sun, 23 Mar 2025 19:57:00 +0100 Subject: [PATCH] posix: net: Fix undefined behavior The signedness of the variable caused undefined behavior because the sign bit is modified when it gets left-shifted. This fixes that by changing it to an unsigned variable. Signed-off-by: Daniel Hajjar --- lib/posix/options/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/posix/options/net.c b/lib/posix/options/net.c index 84e4001a9b40..883bb9145ac9 100644 --- a/lib/posix/options/net.c +++ b/lib/posix/options/net.c @@ -19,7 +19,7 @@ in_addr_t inet_addr(const char *cp) { - int val = 0; + unsigned int val = 0; int len = 0; int dots = 0; int digits = 0;