Commit c00d4938 authored by rswindell's avatar rswindell
Browse files

Include filename in "File not found" error message when displaying msgs with

file attachments.
Safer string buffer management.
parent ce013fd2
......@@ -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 2015 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 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 *
......@@ -44,6 +44,7 @@ void sbbs_t::readmail(uint usernumber, int which)
{
char str[256],str2[256],str3[256],done=0,domsg=1
,*p,*tp,*sp,ch;
char path[MAX_PATH+1];
char tmp[512];
int i;
uint32_t u,v;
......@@ -245,8 +246,7 @@ void sbbs_t::readmail(uint usernumber, int which)
if(msg.hdr.auxattr&MSG_FILEATTACH) { /* Attached file */
smb_getmsgidx(&smb,&msg);
strcpy(str,msg.subj); /* filenames in title */
// strupr(str);
SAFECOPY(str, msg.subj); /* filenames (multiple?) in title */
tp=str;
while(online) {
p=strchr(tp,' ');
......@@ -255,11 +255,11 @@ void sbbs_t::readmail(uint usernumber, int which)
if(!sp) sp=strrchr(tp,'\\');
if(sp) tp=sp+1;
padfname(tp,fd.name);
sprintf(str2,"%sfile/%04u.in/%s" /* str2 is path/fname */
SAFEPRINTF3(path,"%sfile/%04u.in/%s" /* path is path/fname */
,cfg.data_dir,msg.idx.to,tp);
length=(long)flength(str2);
length=(long)flength(path);
if(length<1)
bputs(text[FileNotFound]);
bprintf(text[FileDoesNotExist], tp);
else if(!(useron.exempt&FLAG('T')) && cur_cps && !SYSOP
&& length/(long)cur_cps>(time_t)timeleft)
bputs(text[NotEnoughTimeToDl]);
......@@ -283,10 +283,10 @@ void sbbs_t::readmail(uint usernumber, int which)
&& chk_ar(cfg.prot[i]->ar,&useron,&client))
break;
if(i<cfg.total_prots) {
error=protocol(cfg.prot[i],XFER_DOWNLOAD,str2,nulstr,false);
error=protocol(cfg.prot[i],XFER_DOWNLOAD,path,nulstr,false);
if(checkprotresult(cfg.prot[i],error,&fd)) {
if(which==MAIL_YOUR)
remove(str2);
remove(path);
logon_dlb+=length; /* Update stats */
logon_dls++;
useron.dls=(ushort)adjustuserrec(&cfg,useron.number
......
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