]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix dirname(3) usage.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 2 May 2014 11:59:29 +0000 (12:59 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 2 May 2014 11:59:29 +0000 (12:59 +0100)
src/libutil/http.c

index 5bafc91cdfaab3c0b0b499de87735eb366ce8bb8..22f87026207eae92fe3b28aa9e5879873a146c15 100644 (file)
@@ -1084,9 +1084,9 @@ rspamd_http_router_try_file (struct rspamd_http_connection_entry *entry,
        }
 
        /* We also need to ensure that file is inside the defined dir */
-       dir = dirname (realbuf);
-       if (dir == NULL || strncmp (dir, entry->rt->default_fs_path,
-                       strlen (entry->rt->default_fs_path)) != 0) {
+       rspamd_strlcpy (filebuf, realbuf, sizeof (filebuf));
+       dir = dirname (filebuf);
+       if (dir == NULL || strcmp (dir, entry->rt->default_fs_path) != 0) {
                return FALSE;
        }