Fix to handle values ​​0 and below when converting prefix_len 89/319789/1 tizen
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 18 Feb 2025 03:02:41 +0000 (12:02 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 18 Feb 2025 03:02:41 +0000 (12:02 +0900)
Change-Id: I30b4922c12277aaa08877af7eb585c52658edb95
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/connection_profile.c

index 738eda72b085bec77c6175f31c95bb65a961c301..a45fba1d7ea9dfb112ca2c7e671357136f0695d5 100755 (executable)
@@ -292,6 +292,9 @@ static unsigned char __profile_convert_netmask_to_prefix_len(const char *netmask
 
 static in_addr_t __profile_convert_prefix_len_to_netmask(int prefix_len)
 {
+       if (prefix_len <= 0)
+               return 0;
+
        return (prefix_len & ~31) ? 0xFFFFFFFFu : htonl(0xFFFFFFFFu << (32 - prefix_len));
 }