From: Frédéric Marchal Date: Wed, 14 Jul 2010 18:15:07 +0000 (+0000) Subject: Report an error if the output directory is a subdirectory of the temporary directory. X-Git-Tag: v2.3.1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c74d05aaae7ccca48b3407149d97a7f76a23f0f;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);