From 02340285c564a7e82105137192d46d554a6fce3a Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Sun, 30 May 2021 20:37:54 +0100 Subject: Added -Wshorten-64-to-32 and fixed all warnings. --- src/modules/m_gateway.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/modules/m_gateway.cpp') diff --git a/src/modules/m_gateway.cpp b/src/modules/m_gateway.cpp index dbf2d9b4c..25489f14e 100644 --- a/src/modules/m_gateway.cpp +++ b/src/modules/m_gateway.cpp @@ -197,8 +197,12 @@ class CommandHexIP : public SplitCommand if (errno) return false; + // If the converted IP address is > 32 bits then it's not valid so bail. + if (address > UINT32_MAX) + return false; + out.in4.sin_family = AF_INET; - out.in4.sin_addr.s_addr = htonl(address); + out.in4.sin_addr.s_addr = htonl(uint32_t(address)); return true; } }; -- cgit v1.3.1-10-gc9f91