summaryrefslogtreecommitdiff
path: root/src/identd
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2020-02-25 23:07:26 +0100
committerlouiz’ <louiz@louiz.org>2020-02-25 23:07:26 +0100
commit5fbd900fd681a8d907f356ba1085899e4ec0e2c1 (patch)
treee9a6849b1d5dd8d3f4d365fa9021dc7ec6c472fd /src/identd
parent23f3f48b4aaca4d933b0fc448482c463dd2f31be (diff)
downloadbiboumi-5fbd900fd681a8d907f356ba1085899e4ec0e2c1.tar.gz
biboumi-5fbd900fd681a8d907f356ba1085899e4ec0e2c1.tar.bz2
biboumi-5fbd900fd681a8d907f356ba1085899e4ec0e2c1.tar.xz
biboumi-5fbd900fd681a8d907f356ba1085899e4ec0e2c1.zip
Ignore malformed identd queries
fix #3422
Diffstat (limited to 'src/identd')
-rw-r--r--src/identd/identd_socket.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/identd/identd_socket.cpp b/src/identd/identd_socket.cpp
index 422c5c0..7688bbe 100644
--- a/src/identd/identd_socket.cpp
+++ b/src/identd/identd_socket.cpp
@@ -25,10 +25,12 @@ void IdentdSocket::parse_in_buffer(const std::size_t)
std::istringstream line(this->in_buf.substr(0, line_end));
this->consume_in_buffer(line_end + 1);
- uint16_t local_port;
- uint16_t remote_port;
+ uint16_t local_port{};
+ uint16_t remote_port{};
char sep;
line >> local_port >> sep >> remote_port;
+ if (line.fail()) // Data did not match the expected format, ignore the line entirely
+ continue;
const auto& xmpp = this->server.get_biboumi_component();
auto response = this->generate_answer(xmpp, local_port, remote_port);