Skip to content
Snippets Groups Projects
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
Branches
Tags
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * @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 * * This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License * * modify it under the terms of the GNU General Public License *
...@@ -44,6 +44,7 @@ void sbbs_t::readmail(uint usernumber, int which) ...@@ -44,6 +44,7 @@ void sbbs_t::readmail(uint usernumber, int which)
{ {
char str[256],str2[256],str3[256],done=0,domsg=1 char str[256],str2[256],str3[256],done=0,domsg=1
,*p,*tp,*sp,ch; ,*p,*tp,*sp,ch;
char path[MAX_PATH+1];
char tmp[512]; char tmp[512];
int i; int i;
uint32_t u,v; uint32_t u,v;
...@@ -245,8 +246,7 @@ void sbbs_t::readmail(uint usernumber, int which) ...@@ -245,8 +246,7 @@ void sbbs_t::readmail(uint usernumber, int which)
if(msg.hdr.auxattr&MSG_FILEATTACH) { /* Attached file */ if(msg.hdr.auxattr&MSG_FILEATTACH) { /* Attached file */
smb_getmsgidx(&smb,&msg); smb_getmsgidx(&smb,&msg);
strcpy(str,msg.subj); /* filenames in title */ SAFECOPY(str, msg.subj); /* filenames (multiple?) in title */
// strupr(str);
tp=str; tp=str;
while(online) { while(online) {
p=strchr(tp,' '); p=strchr(tp,' ');
...@@ -255,11 +255,11 @@ void sbbs_t::readmail(uint usernumber, int which) ...@@ -255,11 +255,11 @@ void sbbs_t::readmail(uint usernumber, int which)
if(!sp) sp=strrchr(tp,'\\'); if(!sp) sp=strrchr(tp,'\\');
if(sp) tp=sp+1; if(sp) tp=sp+1;
padfname(tp,fd.name); 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); ,cfg.data_dir,msg.idx.to,tp);
length=(long)flength(str2); length=(long)flength(path);
if(length<1) if(length<1)
bputs(text[FileNotFound]); bprintf(text[FileDoesNotExist], tp);
else if(!(useron.exempt&FLAG('T')) && cur_cps && !SYSOP else if(!(useron.exempt&FLAG('T')) && cur_cps && !SYSOP
&& length/(long)cur_cps>(time_t)timeleft) && length/(long)cur_cps>(time_t)timeleft)
bputs(text[NotEnoughTimeToDl]); bputs(text[NotEnoughTimeToDl]);
...@@ -283,10 +283,10 @@ void sbbs_t::readmail(uint usernumber, int which) ...@@ -283,10 +283,10 @@ void sbbs_t::readmail(uint usernumber, int which)
&& chk_ar(cfg.prot[i]->ar,&useron,&client)) && chk_ar(cfg.prot[i]->ar,&useron,&client))
break; break;
if(i<cfg.total_prots) { 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(checkprotresult(cfg.prot[i],error,&fd)) {
if(which==MAIL_YOUR) if(which==MAIL_YOUR)
remove(str2); remove(path);
logon_dlb+=length; /* Update stats */ logon_dlb+=length; /* Update stats */
logon_dls++; logon_dls++;
useron.dls=(ushort)adjustuserrec(&cfg,useron.number useron.dls=(ushort)adjustuserrec(&cfg,useron.number
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment