commit 7bf24f0: [Minor] Fix a corner case

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 7 22:14:05 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-02-07 22:08:29 +0000
URL: https://github.com/rspamd/rspamd/commit/7bf24f093da9151b8b8887fd40b64a51d1116437 (HEAD -> master)

[Minor] Fix a corner case

---
 src/libutil/upstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 37918dd48..d22e71354 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -664,7 +664,7 @@ rspamd_upstream_resolve_addrs (const struct upstream_list *ls,
 			char dns_name[253 + 1]; /* 253 == max dns name + \0 */
 			const char *semicolon_pos = strchr(upstream->name, ':');
 
-			if (semicolon_pos != NULL) {
+			if (semicolon_pos != NULL && semicolon_pos > upstream->name) {
 				if (sizeof (dns_name) > semicolon_pos - upstream->name) {
 					rspamd_strlcpy(dns_name, upstream->name, semicolon_pos - upstream->name);
 				}


More information about the Commits mailing list