]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix a corner case
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 7 Feb 2022 22:08:29 +0000 (22:08 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 7 Feb 2022 22:08:29 +0000 (22:08 +0000)
src/libutil/upstream.c

index 37918dd48b4680dec7b1d9a4124df798cfc66300..d22e71354aa7f1e1a1078c086ae0c2202bffe786 100644 (file)
@@ -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);
                                }