From 6ddae40a5b23d21b78c63921d56473068a2d6974 Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Tue, 8 Mar 2022 23:31:35 -0800 Subject: [PATCH] Fix EXITINFO.BBS generation for 64-bit time_t and more So I was working on re-writing some of this door file generation code and noticed that the EXITINFO.BBS files generated by SBBS: 1. had a lot of garbage data filling unused string characters (no "harm", but potentially leaking information) 2. had the wrong total file length due to 64-bit logontime (time_t) 3. had the wrong total file length due to writing 19 GosubData elements (instead of 20) The first and last issues appear to be some of those "forever" (20+ year old) bugs. So I'm guessing no regularly used door games actually use these portions of the EXITINFO.BBS, so most likely: no harm, no foul. But still, best to fix this before I commit the rewrite. --- src/sbbs3/xtrn_sec.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/sbbs3/xtrn_sec.cpp b/src/sbbs3/xtrn_sec.cpp index 8cc3bb3eff..c8595582a7 100644 --- a/src/sbbs3/xtrn_sec.cpp +++ b/src/sbbs3/xtrn_sec.cpp @@ -545,18 +545,19 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT|O_TRUNC); return; } + char blank[256]{}; w=(WORD)dte_rate; write(file,&w,sizeof(w)); /* BaudRate */ /* SysInfo */ getstats(&cfg,0,&stats); write(file,&stats.logons,sizeof(stats.logons)); /* CallCount */ - write(file,nulstr,36); /* LastCallerName */ - write(file,nulstr,36); /* LastCallerAlias */ - write(file,nulstr,92); /* ExtraSpace */ + write(file,blank,36); /* LastCallerName */ + write(file,blank,36); /* LastCallerAlias */ + write(file,blank,92); /* ExtraSpace */ /* TimeLogInfo */ - write(file,nulstr,9); /* StartDate */ - write(file,nulstr,24*sizeof(int16_t)); /* BusyPerHour */ - write(file,nulstr,7*sizeof(int16_t)); /* BusyPerDay */ + write(file,blank,9); /* StartDate */ + write(file,blank,24*sizeof(int16_t)); /* BusyPerHour */ + write(file,blank,7*sizeof(int16_t)); /* BusyPerDay */ /* UserInfo */ str2pas(name,str); /* Name */ write(file,str,36); @@ -636,7 +637,7 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl str2pas(tmp,str); write(file,str,9); /* LoginDate */ write(file,&cfg.level_timepercall[useron.level],sizeof(int16_t)); /* TmLimit */ - write(file,&logontime,sizeof(logontime)); /* LoginSec */ + write(file,&logontime,sizeof(time32_t)); /* LoginSec */ write(file,&useron.cdt,sizeof(useron.cdt)); /* Credit */ write(file,&useron.number,sizeof(useron.number)); /* UserRecNum */ i=0; @@ -649,7 +650,7 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, ulong tl write(file,&c,1); /* GosubLevel */ memset(str,0,255); - for(i=1;i<20;i++) + for(i=0;i<20;i++) write(file,str,9); /* GosubData */ write(file,str,9); /* Menu */ c=useron.misc&CLRSCRN ? 1:0; -- GitLab