Commit a1978c3b authored by rswindell's avatar rswindell
Browse files

Defined extended file description buffer length (512) as F_EXBSIZE.

parent 5143a358
......@@ -642,18 +642,18 @@ void DLLCALL getextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext)
char str[256];
int file;
memset(ext,0,513);
memset(ext,0,F_EXBSIZE+1);
sprintf(str,"%s%s.exb",cfg->dir[dirnum]->data_dir,cfg->dir[dirnum]->code);
if((file=nopen(str,O_RDONLY))==-1)
return;
lseek(file,(datoffset/F_LEN)*512L,SEEK_SET);
read(file,ext,512);
lseek(file,(datoffset/F_LEN)*F_EXBSIZE,SEEK_SET);
read(file,ext,F_EXBSIZE);
close(file);
}
void DLLCALL putextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext)
{
char str[256],nulbuf[512];
char str[256],nulbuf[F_EXBSIZE];
int file;
memset(nulbuf,0,sizeof(nulbuf));
......@@ -661,9 +661,9 @@ void DLLCALL putextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext)
if((file=nopen(str,O_WRONLY|O_CREAT))==-1)
return;
lseek(file,0L,SEEK_END);
while(filelength(file)<(long)(datoffset/F_LEN)*512L)
write(file,nulbuf,512);
lseek(file,(datoffset/F_LEN)*512L,SEEK_SET);
write(file,ext,512);
while(filelength(file)<(long)(datoffset/F_LEN)*F_EXBSIZE)
write(file,nulbuf,sizeof(nulbuf));
lseek(file,(datoffset/F_LEN)*F_EXBSIZE,SEEK_SET);
write(file,ext,F_EXBSIZE);
close(file);
}
......@@ -549,6 +549,8 @@ typedef enum { /* Values for xtrn_t.event */
#define F_IXBSIZE 22 /* Length of each index entry */
#define F_EXBSIZE 512 /* Length of each ext-desc entry */
#define SIF_MAXBUF 0x7000 /* Maximum buffer size of SIF data */
......
......@@ -45,7 +45,10 @@
/****************************************************************************/
bool sbbs_t::uploadfile(file_t *f)
{
char path[256],str[256],fname[25],ext[513],desc[513],tmp[128];
char path[256],str[256],fname[25];
char ext[F_EXBSIZE+1];
char desc[F_EXBSIZE+1];
char tmp[128];
int file;
uint i;
long length;
......@@ -137,9 +140,9 @@ bool sbbs_t::uploadfile(file_t *f)
remove(str);
external(cmdstr(cfg.fextr[i]->cmd,path,"DESC.SDI",NULL),EX_OUTL); }
if((file=nopen(str,O_RDONLY))!=-1) {
memset(ext,0,513);
read(file,ext,512);
for(i=512;i;i--)
memset(ext,0,F_EXBSIZE+1);
read(file,ext,F_EXBSIZE);
for(i=F_EXBSIZE;i;i--)
if(ext[i-1]>SP)
break;
ext[i]=0;
......
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