]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix string copy
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 8 Mar 2018 17:07:53 +0000 (17:07 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 8 Mar 2018 17:07:53 +0000 (17:07 +0000)
src/libmime/content_type.c
src/libutil/str_util.c

index 946a9b838b89ebb559aae078bb67ed9c86b90665..bcb047898167ef1433d24455b7375e6dbcbb5112 100644 (file)
@@ -502,8 +502,8 @@ rspamd_content_disposition_parse (const gchar *in,
 {
        struct rspamd_content_disposition *res = NULL, val;
 
-       val.lc_data = rspamd_mempool_alloc (pool, len);
-       memcpy (val.lc_data, in, len);
+       val.lc_data = rspamd_mempool_alloc (pool, len + 1);
+       rspamd_strlcpy (val.lc_data, in, len);
        rspamd_str_lc (val.lc_data, len);
 
        if (rspamd_content_disposition_parser (in, len, &val, pool)) {
index 69b17fb4f15347c808362640383303e1723626d9..c111b0a96f9f468ba38e10897c229fc028aad3f2 100644 (file)
@@ -79,10 +79,12 @@ rspamd_str_lc (gchar *str, guint size)
        switch (leftover) {
        case 3:
                *dest++ = lc_map[(guchar)str[i++]];
+               /* falltrough */
        case 2:
                *dest++ = lc_map[(guchar)str[i++]];
+               /* falltrough */
        case 1:
-               *dest++ = lc_map[(guchar)str[i]];
+               *dest = lc_map[(guchar)str[i]];
        }
 
 }