]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another out-of-boundary access fix
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 Sep 2018 13:06:40 +0000 (14:06 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 Sep 2018 13:06:40 +0000 (14:06 +0100)
src/libserver/spf.c

index aa14bc750158c399087e8f7a3e3cde2e6876c11e..372b20189effe319a471e1e83217dff7da3625a8 100644 (file)
@@ -1973,12 +1973,15 @@ start_spf_parse (struct spf_record *rec, struct spf_resolved_element *resolved,
                gchar *begin)
 {
        gchar **elts, **cur_elt;
+       gsize len;
 
        /* Skip spaces */
        while (g_ascii_isspace (*begin)) {
                begin++;
        }
 
+       len = strlen (begin);
+
        if (g_ascii_strncasecmp (begin, SPF_VER1_STR, sizeof (SPF_VER1_STR) - 1) ==
                0) {
                begin += sizeof (SPF_VER1_STR) - 1;
@@ -2006,8 +2009,9 @@ start_spf_parse (struct spf_record *rec, struct spf_resolved_element *resolved,
                                "<%s>: spf error for domain %s: bad spf record start: %*s",
                                rec->task->message_id,
                                rec->sender_domain,
-                               (gint)sizeof (SPF_VER1_STR) - 1,
+                               (gint)len,
                                begin);
+
                return FALSE;
        }