aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_gateway.cpp
diff options
context:
space:
mode:
authorGravatar Dominic Hamon2021-05-30 20:37:54 +0100
committerGravatar GitHub2021-05-30 20:37:54 +0100
commit02340285c564a7e82105137192d46d554a6fce3a (patch)
tree696d1a6249841de62c3fed70310c2a347fc66732 /src/modules/m_gateway.cpp
parentAdd a workaround for a bug in GitHub Actions. (diff)
Added -Wshorten-64-to-32 and fixed all warnings.
Diffstat (limited to 'src/modules/m_gateway.cpp')
-rw-r--r--src/modules/m_gateway.cpp6
1 files changed, 5 insertions, 1 deletions
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;
}
};