commit aefb215: [Minor] Check the last split when wrapping

Vsevolod Stakhov vsevolod at rspamd.com
Sun Jan 22 12:56:04 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-01-22 12:48:37 +0000
URL: https://github.com/rspamd/rspamd/commit/aefb2153a88a11cce249f709e10a19ad8d8d39fd (HEAD -> master)

[Minor] Check the last split when wrapping
Reported by: @amishmm

---
 src/client/rspamc.cxx | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx
index c757000db..a2bf4c783 100644
--- a/src/client/rspamc.cxx
+++ b/src/client/rspamc.cxx
@@ -847,6 +847,10 @@ rspamc_print_indented_line(FILE *out, std::string_view line) -> void
 				suffix = suffix.substr(delim_pos + 1);
 			}
 			else {
+				/* Check if we can include one last word */
+				if (delim_pos == std::string_view::npos && word_len + suffix.size() < split_len) {
+					word_len += suffix.size();
+				}
 				break;
 			}
 		}


More information about the Commits mailing list