aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-05 15:48:29 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-10-05 15:48:29 +0100
commitd6323c9c3dcfb8e4f9e6fc2570f36ee20ea223ef (patch)
treea4f3fed0b34f3d3545578a2d913d51a690efb5af /src/libmime
parent90b664698c6d9edffc8a24fb634777f8d58a857a (diff)
downloadrspamd-d6323c9c3dcfb8e4f9e6fc2570f36ee20ea223ef.tar.gz
rspamd-d6323c9c3dcfb8e4f9e6fc2570f36ee20ea223ef.zip
[Minor] Fix rfind usage
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/received.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libmime/received.cxx b/src/libmime/received.cxx
index 5a04c812b..a39844f13 100644
--- a/src/libmime/received.cxx
+++ b/src/libmime/received.cxx
@@ -489,9 +489,9 @@ received_process_host_tcpinfo(struct rspamd_task *task,
auto obrace_pos = in.find('[');
if (obrace_pos != std::string_view::npos) {
- auto ebrace_pos = in.rfind(']', obrace_pos);
+ auto ebrace_pos = in.rfind(']');
- if (ebrace_pos != std::string_view::npos) {
+ if (ebrace_pos != std::string_view::npos && ebrace_pos > obrace_pos) {
auto substr_addr = in.substr(obrace_pos + 1,
ebrace_pos - obrace_pos - 1);
addr = rspamd_parse_inet_address_pool(substr_addr.data(),