]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Report an error if the output directory is a subdirectory of the temporary directory.
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 14 Jul 2010 18:15:07 +0000 (18:15 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 14 Jul 2010 18:15:07 +0000 (18:15 +0000)
log.c

diff --git a/log.c b/log.c
index 34d1f63f40882038982d4e5d713de72892133fdf..19360412e5b091b73125e05d78baa0ba872b71e6 100644 (file)
--- a/log.c
+++ b/log.c
@@ -613,6 +613,11 @@ int main(int argc,char *argv[])
    */
    strcat(tmp,"/sarg");
 
+   if (tmp[0]!='\0' && strncmp(outdir,tmp,strlen(tmp))==0) {
+      debuga(_("The output directory \"%s\" must be outside of the temporary directory \"%s\"\n"),outdir,tmp);
+      exit(EXIT_FAILURE);
+   }
+
    if(df[0] == '\0') strcpy(df,DateFormat);
    else strcpy(DateFormat,df);