commit 2367a70: [Minor] Fix off-by-one read

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Jul 7 16:42:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-07 17:38:04 +0100
URL: https://github.com/rspamd/rspamd/commit/2367a70d32a34ae044c209a76eafe605a820ae81 (HEAD -> master)

[Minor] Fix off-by-one read

---
 src/libserver/html/html_entities.cxx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libserver/html/html_entities.cxx b/src/libserver/html/html_entities.cxx
index 0d5b7d4de..9ed080d4f 100644
--- a/src/libserver/html/html_entities.cxx
+++ b/src/libserver/html/html_entities.cxx
@@ -2283,9 +2283,9 @@ decode_html_entitles_inplace(char *s, std::size_t len, bool norm_spaces)
 			heuristic_lookup_func(2);
 
 			/* Leave undecoded */
-			if (!entity_def && (end - t > h - e + 1)) {
-				memmove(t, e, h - e + 1);
-				t += h - e + 1;
+			if (!entity_def && (end - t > h - e)) {
+				memmove(t, e, h - e);
+				t += h - e;
 			}
 			else if (entity_def) {
 				return true;


More information about the Commits mailing list