commit d6323c9: [Minor] Fix rfind usage
Vsevolod Stakhov
vsevolod at highsecure.ru
Tue Oct 5 15:56:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-10-05 15:48:29 +0100
URL: https://github.com/rspamd/rspamd/commit/d6323c9c3dcfb8e4f9e6fc2570f36ee20ea223ef (HEAD -> master)
[Minor] Fix rfind usage
---
src/libmime/received.cxx | 4 ++--
1 file 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(),
More information about the Commits
mailing list