From: Frédéric Marchal Date: Sat, 18 Sep 2010 12:32:32 +0000 (+0000) Subject: Report an error if the output directory is a subdirectory of the temporary directory. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=480dd4c52b551479571409bf0e567a8094af3127;p=thirdparty%2Fsarg.git Report an error if the output directory is a subdirectory of the temporary directory. --- diff --git a/log.c b/log.c index 34d1f63..1936041 100644 --- 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);