Commit d63f2e10 authored by rswindell's avatar rswindell
Browse files

getfilespec() now supports lower/mixed-case file specifications and up to 64

chars (probably overkill).
checkfname() now rejects filenames begining with a dash as a "suspicious
filename".
parent 8a9fe699
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -222,7 +222,7 @@ void sbbs_t::closefile(file_t* f)
char * sbbs_t::getfilespec(char *str)
{
bputs(text[FileSpecStarDotStar]);
if(!getstr(str,12,K_UPPER))
if(!getstr(str,64,K_NONE))
strcpy(str,ALLFILES);
#if 0
else if(!strchr(str,'.') && strlen(str)<=8)
......@@ -261,10 +261,12 @@ bool sbbs_t::checkfname(char *fname)
char str[256];
int c=0,d;
if(strcspn(fname,ILLEGAL_FILENAME_CHARS)!=strlen(fname)) {
sprintf(str,"Suspicious filename attempt: '%s'",fname);
if(fname[0]=='-'
|| strcspn(fname,ILLEGAL_FILENAME_CHARS)!=strlen(fname)) {
SAFEPRINTF(str,"Suspicious filename attempt: '%s'",fname);
errorlog(str);
return(false); }
return(false);
}
if(strstr(fname,".."))
return(false);
#if 0 /* long file name support */
......@@ -275,6 +277,7 @@ bool sbbs_t::checkfname(char *fname)
while(c<d) {
if(fname[c]<=' ' || fname[c]&0x80)
return(false);
c++; }
c++;
}
return(true);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment