From: Vsevolod Stakhov Date: Fri, 2 May 2014 11:59:29 +0000 (+0100) Subject: Fix dirname(3) usage. X-Git-Tag: 0.7.0~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1bdd6b9b770fe11c3167e3365b236041a2f5582a;p=thirdparty%2Frspamd.git Fix dirname(3) usage. --- diff --git a/src/libutil/http.c b/src/libutil/http.c index 5bafc91cdf..22f8702620 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -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; }