diff options
| author | 2021-05-30 20:37:54 +0100 | |
|---|---|---|
| committer | 2021-05-30 20:37:54 +0100 | |
| commit | 02340285c564a7e82105137192d46d554a6fce3a (patch) | |
| tree | 696d1a6249841de62c3fed70310c2a347fc66732 /src/modules/m_gateway.cpp | |
| parent | Add 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.cpp | 6 |
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; } }; |
