Secured sprintf with snprintf

This commit is contained in:
Michiel Broek 2005-08-28 14:10:06 +00:00
parent 581cdc9c7f
commit 1c8719c1de
31 changed files with 269 additions and 269 deletions

View File

@ -49,7 +49,7 @@ FILE *newpage(char *Name, FILE *fi)
later = time(NULL) + 86400; later = time(NULL) + 86400;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/stat/%s.temp", CFG.www_root, Name); snprintf(temp, PATH_MAX, "%s/stat/%s.temp", CFG.www_root, Name);
mkdirs(temp, 0755); mkdirs(temp, 0755);
if ((fa = fopen(temp, "w")) == NULL) { if ((fa = fopen(temp, "w")) == NULL) {
@ -79,8 +79,8 @@ void closepage(FILE *fa, char *Name, FILE *fi)
temp2 = calloc(PATH_MAX, sizeof(char)); temp2 = calloc(PATH_MAX, sizeof(char));
MacroRead(fi, fa); MacroRead(fi, fa);
fclose(fa); fclose(fa);
snprintf(temp1, PATH_MAX -1, "%s/stat/%s.html", CFG.www_root, Name); snprintf(temp1, PATH_MAX, "%s/stat/%s.html", CFG.www_root, Name);
snprintf(temp2, PATH_MAX -1, "%s/stat/%s.temp", CFG.www_root, Name); snprintf(temp2, PATH_MAX, "%s/stat/%s.temp", CFG.www_root, Name);
rename(temp2, temp1); rename(temp2, temp1);
chmod(temp1, 0644); chmod(temp1, 0644);
free(temp2); free(temp2);
@ -97,10 +97,10 @@ char *adate(time_t now)
struct tm ptm; struct tm ptm;
if (now == 0L) { if (now == 0L) {
snprintf(buf, 39, " "); snprintf(buf, 40, " ");
} else { } else {
ptm = *localtime(&now); ptm = *localtime(&now);
snprintf(buf, 39, "%02d-%02d-%04d %02d:%02d", ptm.tm_mday, ptm.tm_mon +1, ptm.tm_year + 1900, ptm.tm_hour, ptm.tm_min); snprintf(buf, 40, "%02d-%02d-%04d %02d:%02d", ptm.tm_mday, ptm.tm_mon +1, ptm.tm_year + 1900, ptm.tm_hour, ptm.tm_min);
} }
return buf; return buf;
} }
@ -133,7 +133,7 @@ void MakeStat(void)
else else
Lm = Miy -1; Lm = Miy -1;
snprintf(name, PATH_MAX -1, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("Can't open %s", name); WriteError("Can't open %s", name);
} else { } else {
@ -174,7 +174,7 @@ void MakeStat(void)
printf("."); printf(".");
fflush(stdout); fflush(stdout);
} }
snprintf(name, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("$Can't open %s", name); WriteError("$Can't open %s", name);
} else { } else {
@ -225,7 +225,7 @@ void MakeStat(void)
printf("."); printf(".");
fflush(stdout); fflush(stdout);
} }
snprintf(name, PATH_MAX -1, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("$Can't open %s", name); WriteError("$Can't open %s", name);
} else { } else {
@ -265,7 +265,7 @@ void MakeStat(void)
printf("."); printf(".");
fflush(stdout); fflush(stdout);
} }
snprintf(name, PATH_MAX -1, "%s/etc/tic.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/tic.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("$Can't open %s", name); WriteError("$Can't open %s", name);
} else { } else {
@ -307,7 +307,7 @@ void MakeStat(void)
printf("."); printf(".");
fflush(stdout); fflush(stdout);
} }
snprintf(name, PATH_MAX -1, "%s/etc/nodes.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("$Can't open %s", name); WriteError("$Can't open %s", name);
} else { } else {
@ -355,7 +355,7 @@ void MakeStat(void)
printf("."); printf(".");
fflush(stdout); fflush(stdout);
} }
snprintf(name, PATH_MAX -1, "%s/var/mailer.hist", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/var/mailer.hist", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("$Can't open %s", name); WriteError("$Can't open %s", name);
} else { } else {
@ -407,7 +407,7 @@ void MakeStat(void)
printf("."); printf(".");
fflush(stdout); fflush(stdout);
} }
snprintf(name, PATH_MAX -1, "%s/etc/sysinfo.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) != NULL ) { if ((fg = fopen(name, "r")) != NULL ) {
if ((fi = OpenMacro("html.sysinfo", 'E', TRUE)) == NULL) { if ((fi = OpenMacro("html.sysinfo", 'E', TRUE)) == NULL) {
Syslog('+', "Can't open macro file, skipping html pages creation"); Syslog('+', "Can't open macro file, skipping html pages creation");

View File

@ -67,7 +67,7 @@ void Kill(void)
printf("Kill/move files...\n"); printf("Kill/move files...\n");
} }
snprintf(sAreas, PATH_MAX -1, "%s/etc/fareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);
@ -148,8 +148,8 @@ void Kill(void)
if (area.MoveArea) { if (area.MoveArea) {
fseek(pAreas, ((area.MoveArea -1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET); fseek(pAreas, ((area.MoveArea -1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET);
fread(&darea, areahdr.recsize, 1, pAreas); fread(&darea, areahdr.recsize, 1, pAreas);
snprintf(from, PATH_MAX -1, "%s/%s", area.Path, fdb.Name); snprintf(from, PATH_MAX, "%s/%s", area.Path, fdb.Name);
snprintf(to, PATH_MAX -1, "%s/%s", darea.Path, fdb.Name); snprintf(to, PATH_MAX, "%s/%s", darea.Path, fdb.Name);
if ((rc = file_mv(from, to)) == 0) { if ((rc = file_mv(from, to)) == 0) {
Syslog('+', "Move %s, area %d => %d", fdb.Name, i, area.MoveArea); Syslog('+', "Move %s, area %d => %d", fdb.Name, i, area.MoveArea);
if ((dst_area = mbsedb_OpenFDB(area.MoveArea, 30))) { if ((dst_area = mbsedb_OpenFDB(area.MoveArea, 30))) {
@ -162,22 +162,22 @@ void Kill(void)
/* /*
* Now again if there is a dotted version (thumbnail) of this file. * Now again if there is a dotted version (thumbnail) of this file.
*/ */
snprintf(from, PATH_MAX -1, "%s/.%s", area.Path, fdb.Name); snprintf(from, PATH_MAX, "%s/.%s", area.Path, fdb.Name);
snprintf(to, PATH_MAX -1, "%s/.%s", darea.Path, fdb.Name); snprintf(to, PATH_MAX, "%s/.%s", darea.Path, fdb.Name);
if (file_exist(from, R_OK) == 0) if (file_exist(from, R_OK) == 0)
file_mv(from, to); file_mv(from, to);
/* /*
* Unlink the old symbolic link * Unlink the old symbolic link
*/ */
snprintf(from, PATH_MAX -1, "%s/%s", area.Path, fdb.LName); snprintf(from, PATH_MAX, "%s/%s", area.Path, fdb.LName);
unlink(from); unlink(from);
/* /*
* Create the new symbolic link * Create the new symbolic link
*/ */
snprintf(from, PATH_MAX -1, "%s/%s", darea.Path, fdb.Name); snprintf(from, PATH_MAX, "%s/%s", darea.Path, fdb.Name);
snprintf(to, PATH_MAX -1, "%s/%s", darea.Path, fdb.LName); snprintf(to, PATH_MAX, "%s/%s", darea.Path, fdb.LName);
symlink(from, to); symlink(from, to);
fdb.Deleted = TRUE; fdb.Deleted = TRUE;
@ -199,11 +199,11 @@ void Kill(void)
mbsedb_UnlockFDB(fdb_area); mbsedb_UnlockFDB(fdb_area);
} }
iKilled++; iKilled++;
snprintf(from, PATH_MAX -1, "%s/%s", area.Path, fdb.LName); snprintf(from, PATH_MAX, "%s/%s", area.Path, fdb.LName);
unlink(from); unlink(from);
snprintf(from, PATH_MAX -1, "%s/%s", area.Path, fdb.Name); snprintf(from, PATH_MAX, "%s/%s", area.Path, fdb.Name);
unlink(from); unlink(from);
snprintf(from, PATH_MAX -1, "%s/.%s", area.Path, fdb.Name); snprintf(from, PATH_MAX, "%s/.%s", area.Path, fdb.Name);
unlink(from); unlink(from);
} }
} }

View File

@ -69,7 +69,7 @@ void ListFileAreas(int Area)
sTic = calloc(PATH_MAX, sizeof(char)); sTic = calloc(PATH_MAX, sizeof(char));
ticarea = calloc(21, sizeof(char)); ticarea = calloc(21, sizeof(char));
snprintf(sAreas, PATH_MAX -1, "%s/etc/fareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);
printf("Can't open %s\n", sAreas); printf("Can't open %s\n", sAreas);
@ -83,7 +83,7 @@ void ListFileAreas(int Area)
if (Area) { if (Area) {
IsDoing("List area %d", Area); IsDoing("List area %d", Area);
snprintf(sTic, PATH_MAX -1, "%s/etc/tic.data", getenv("MBSE_ROOT")); snprintf(sTic, PATH_MAX, "%s/etc/tic.data", getenv("MBSE_ROOT"));
if ((pTic = fopen(sTic, "r")) == NULL) { if ((pTic = fopen(sTic, "r")) == NULL) {
WriteError("Can't open %s", sTic); WriteError("Can't open %s", sTic);
printf("Can't open %s\n", sTic); printf("Can't open %s\n", sTic);
@ -121,7 +121,7 @@ void ListFileAreas(int Area)
mbse_colour(LIGHTGRAY, BLACK); mbse_colour(LIGHTGRAY, BLACK);
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) { while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
snprintf(flags, 3, "---"); snprintf(flags, 4, "---");
if (fdb.Deleted) if (fdb.Deleted)
flags[0] = 'D'; flags[0] = 'D';
if (fdb.NoKill) if (fdb.NoKill)

View File

@ -61,7 +61,7 @@ void PackFileBase(void)
printf("Packing file database...\n"); printf("Packing file database...\n");
} }
snprintf(sAreas, PATH_MAX -1, "%s/etc/fareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);
@ -102,18 +102,18 @@ void PackFileBase(void)
Syslog('+', "Removed double record file \"%s\" from area %d", fdb.LName, i); Syslog('+', "Removed double record file \"%s\" from area %d", fdb.LName, i);
} else { } else {
Syslog('+', "Removed file \"%s\" from area %d", fdb.LName, i); Syslog('+', "Removed file \"%s\" from area %d", fdb.LName, i);
snprintf(fn, PATH_MAX -1, "%s/%s", area.Path, fdb.LName); snprintf(fn, PATH_MAX, "%s/%s", area.Path, fdb.LName);
rc = unlink(fn); rc = unlink(fn);
if (rc && (errno != ENOENT)) if (rc && (errno != ENOENT))
Syslog('+', "Unlink %s failed, result %d", fn, rc); Syslog('+', "Unlink %s failed, result %d", fn, rc);
snprintf(fn, PATH_MAX -1, "%s/%s", area.Path, fdb.Name); snprintf(fn, PATH_MAX, "%s/%s", area.Path, fdb.Name);
rc = unlink(fn); rc = unlink(fn);
if (rc && (errno != ENOENT)) if (rc && (errno != ENOENT))
Syslog('+', "Unlink %s failed, result %d", fn, rc); Syslog('+', "Unlink %s failed, result %d", fn, rc);
/* /*
* If a dotted version (thumbnail) exists, remove it silently * If a dotted version (thumbnail) exists, remove it silently
*/ */
snprintf(fn, PATH_MAX -1, "%s/.%s", area.Path, fdb.Name); snprintf(fn, PATH_MAX, "%s/.%s", area.Path, fdb.Name);
unlink(fn); unlink(fn);
} }
do_index = TRUE; do_index = TRUE;

View File

@ -90,7 +90,7 @@ void ReArc(int Area, char *File)
while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) { while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) {
if (re_exec(fdb.LName) || re_exec(fdb.Name)) { if (re_exec(fdb.LName) || re_exec(fdb.Name)) {
Syslog('+', "Will rearc %s", fdb.LName); Syslog('+', "Will rearc %s", fdb.LName);
snprintf(temp, PATH_MAX -1, "%s/%s", area.Path, fdb.Name); snprintf(temp, PATH_MAX, "%s/%s", area.Path, fdb.Name);
count++; count++;
rc = rearc(temp, area.Archiver, do_quiet); rc = rearc(temp, area.Archiver, do_quiet);
@ -105,7 +105,7 @@ void ReArc(int Area, char *File)
} }
linkpath = calloc(PATH_MAX, sizeof(char)); linkpath = calloc(PATH_MAX, sizeof(char));
snprintf(linkpath, PATH_MAX -1, "%s/%s", area.Path, fdb.LName); snprintf(linkpath, PATH_MAX, "%s/%s", area.Path, fdb.LName);
unlink(linkpath); unlink(linkpath);
Syslog('+', "New name %s", temp); Syslog('+', "New name %s", temp);
@ -129,7 +129,7 @@ void ReArc(int Area, char *File)
*p = '\0'; *p = '\0';
else if ((p = strstr(fdb.Name, "HA"))) else if ((p = strstr(fdb.Name, "HA")))
*p = '\0'; *p = '\0';
snprintf(p, 5, "%s", archiver.name); snprintf(p, 6, "%s", archiver.name);
if ((p = strstr(fdb.LName, "arc"))) if ((p = strstr(fdb.LName, "arc")))
*p = '\0'; *p = '\0';
else if ((p = strstr(fdb.LName, "lha"))) else if ((p = strstr(fdb.LName, "lha")))
@ -154,7 +154,7 @@ void ReArc(int Area, char *File)
*p = '\0'; *p = '\0';
else if ((p = strstr(fdb.LName, "ha"))) else if ((p = strstr(fdb.LName, "ha")))
*p = '\0'; *p = '\0';
snprintf(p, 5, "%s", tl(archiver.name)); snprintf(p, 6, "%s", tl(archiver.name));
Syslog('f', "%s %s", fdb.Name, fdb.LName); Syslog('f', "%s %s", fdb.Name, fdb.LName);
fdb.Size = file_size(temp); fdb.Size = file_size(temp);
fdb.Crc32 = file_crc(temp, FALSE); fdb.Crc32 = file_crc(temp, FALSE);
@ -172,7 +172,7 @@ void ReArc(int Area, char *File)
if (strcmp(fdb.Name, mname)) { if (strcmp(fdb.Name, mname)) {
Syslog('+', "Converted 8.3 name to %s", mname); Syslog('+', "Converted 8.3 name to %s", mname);
strcpy(fdb.Name, mname); strcpy(fdb.Name, mname);
snprintf(mname, PATH_MAX -1, "%s/%s", area.Path, fdb.Name); snprintf(mname, PATH_MAX, "%s/%s", area.Path, fdb.Name);
rename(temp, mname); rename(temp, mname);
strcpy(temp, mname); strcpy(temp, mname);
} }
@ -186,7 +186,7 @@ void ReArc(int Area, char *File)
/* /*
* Update symbolic link to long filename * Update symbolic link to long filename
*/ */
snprintf(linkpath, PATH_MAX -1, "%s/%s", area.Path, fdb.LName); snprintf(linkpath, PATH_MAX, "%s/%s", area.Path, fdb.LName);
symlink(temp, linkpath); symlink(temp, linkpath);
free(linkpath); free(linkpath);
if (strlen(fdb.Magic)) if (strlen(fdb.Magic))

View File

@ -59,7 +59,7 @@ void SortFileBase(int Area)
mbse_colour(CYAN, BLACK); mbse_colour(CYAN, BLACK);
} }
snprintf(sAreas, PATH_MAX -1, "%s/etc/fareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);

View File

@ -57,7 +57,7 @@ void ToBeRep(void)
mbse_colour(CYAN, BLACK); mbse_colour(CYAN, BLACK);
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/toberep.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
printf("No toberep database present\n"); printf("No toberep database present\n");
} else { } else {

View File

@ -209,7 +209,7 @@ void DeleteVirusWork()
buf = calloc(PATH_MAX, sizeof(char)); buf = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
getcwd(buf, PATH_MAX); getcwd(buf, PATH_MAX);
snprintf(temp, PATH_MAX -1, "%s/tmp", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT"));
if (chdir(temp) == 0) { if (chdir(temp) == 0) {
Syslog('f', "DeleteVirusWork %s/arc", temp); Syslog('f', "DeleteVirusWork %s/arc", temp);
@ -243,7 +243,7 @@ int UnpackFile(char *File)
/* /*
* Check if there is a temp directory to unpack the archive. * Check if there is a temp directory to unpack the archive.
*/ */
snprintf(temp, PATH_MAX -1, "%s/tmp/arc", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
if ((access(temp, R_OK)) != 0) { if ((access(temp, R_OK)) != 0) {
if (mkdir(temp, 0777)) { if (mkdir(temp, 0777)) {
WriteError("$Can't create %s", temp); WriteError("$Can't create %s", temp);
@ -256,10 +256,10 @@ int UnpackFile(char *File)
/* /*
* Check for stale FILE_ID.DIZ files * Check for stale FILE_ID.DIZ files
*/ */
snprintf(temp, PATH_MAX -1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
if (!unlink(temp)) if (!unlink(temp))
Syslog('+', "Removed stale %s", temp); Syslog('+', "Removed stale %s", temp);
snprintf(temp, PATH_MAX -1, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
if (!unlink(temp)) if (!unlink(temp))
Syslog('+', "Removed stale %s", temp); Syslog('+', "Removed stale %s", temp);
@ -278,7 +278,7 @@ int UnpackFile(char *File)
return FALSE; return FALSE;
} }
snprintf(temp, PATH_MAX -1, "%s/tmp/arc", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
if (chdir(temp) != 0) { if (chdir(temp) != 0) {
WriteError("$Can't change to %s", temp); WriteError("$Can't change to %s", temp);
die(MBERR_GENERAL); die(MBERR_GENERAL);
@ -367,7 +367,7 @@ int CheckFDB(int Area, char *Path)
int rc = FALSE; int rc = FALSE;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/var/fdb/file%d.data", getenv("MBSE_ROOT"), Area); snprintf(temp, PATH_MAX, "%s/var/fdb/file%d.data", getenv("MBSE_ROOT"), Area);
/* /*
* Open the file database, create new one if it doesn't excist. * Open the file database, create new one if it doesn't excist.
@ -397,7 +397,7 @@ int CheckFDB(int Area, char *Path)
* Now check the download directory * Now check the download directory
*/ */
if (access(Path, W_OK) == -1) { if (access(Path, W_OK) == -1) {
snprintf(temp, PATH_MAX -1, "%s/foobar", Path); snprintf(temp, PATH_MAX, "%s/foobar", Path);
if (mkdirs(temp, 0775)) if (mkdirs(temp, 0775))
Syslog('+', "Created directory %s", Path); Syslog('+', "Created directory %s", Path);
} }
@ -419,7 +419,7 @@ int LoadAreaRec(int Area)
sAreas = calloc(PATH_MAX, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
snprintf(sAreas, PATH_MAX -1, "%s/etc/fareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open %s", sAreas); WriteError("$Can't open %s", sAreas);
if (!do_quiet) if (!do_quiet)

View File

@ -254,7 +254,7 @@ char *fullpath(char *fname)
{ {
static char path[PATH_MAX]; static char path[PATH_MAX];
snprintf(path, PATH_MAX -1, "%s/%s", CFG.nodelists, fname); snprintf(path, PATH_MAX, "%s/%s", CFG.nodelists, fname);
return path; return path;
} }
@ -686,7 +686,7 @@ void fill_fdlist(fd_list **fdp, char *filename, time_t filedate)
tmp = (fd_list *)malloc(sizeof(fd_list)); tmp = (fd_list *)malloc(sizeof(fd_list));
tmp->next = *fdp; tmp->next = *fdp;
snprintf(tmp->fname, 64, "%s", filename); snprintf(tmp->fname, 65, "%s", filename);
tmp->fdate = filedate; tmp->fdate = filedate;
*fdp = tmp; *fdp = tmp;
} }
@ -757,7 +757,7 @@ char *pull_fdlist(fd_list **fdp)
ta = *fdp; ta = *fdp;
memset(&buf, 0, sizeof(buf)); memset(&buf, 0, sizeof(buf));
snprintf(buf, 64, "%s", ta->fname); snprintf(buf, 65, "%s", ta->fname);
if (ta->next != NULL) if (ta->next != NULL)
*fdp = ta->next; *fdp = ta->next;
@ -825,8 +825,8 @@ int makelist(char *base, unsigned short zo, unsigned short ne, unsigned short no
tidy_fdlist(&fdl); tidy_fdlist(&fdl);
memset(&fdx, 0, sizeof(fdx)); memset(&fdx, 0, sizeof(fdx));
snprintf(fdx.filename, 12, "%s", p); snprintf(fdx.filename, 13, "%s", p);
snprintf(fdx.domain, 12, "%s", fidonet.domain); snprintf(fdx.domain, 13, "%s", fidonet.domain);
fdx.number = filenr; fdx.number = filenr;
fwrite(&fdx, sizeof(fdx), 1, ffp); fwrite(&fdx, sizeof(fdx), 1, ffp);

View File

@ -264,7 +264,7 @@ void DoMsgBase()
Syslog('-', "------ ------ ------ ------ ------ ----------------------------------"); Syslog('-', "------ ------ ------ ------ ------ ----------------------------------");
} }
snprintf(sAreas, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if(( pAreas = fopen (sAreas, "r")) == NULL) { if(( pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open %s", sAreas); WriteError("$Can't open %s", sAreas);
die(MBERR_GENERAL); die(MBERR_GENERAL);
@ -331,7 +331,7 @@ void DoMsgBase()
fclose(pAreas); fclose(pAreas);
if (!do_area) { if (!do_area) {
snprintf(sAreas, PATH_MAX -1, "%s/etc/users.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen (sAreas, "r")) == NULL) { if ((pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open %s", sAreas); WriteError("$Can't open %s", sAreas);
die(MBERR_GENERAL); die(MBERR_GENERAL);
@ -341,13 +341,13 @@ void DoMsgBase()
while (fread(&usrconfig, usrconfighdr.recsize, 1, pAreas) == 1) { while (fread(&usrconfig, usrconfighdr.recsize, 1, pAreas) == 1) {
if (usrconfig.Email && strlen(usrconfig.Name)) { if (usrconfig.Email && strlen(usrconfig.Name)) {
Nopper(); Nopper();
snprintf(Name, PATH_MAX -1, "User %s email area: mailbox", usrconfig.Name); snprintf(Name, PATH_MAX, "User %s email area: mailbox", usrconfig.Name);
if (!do_quiet) { if (!do_quiet) {
mbse_colour(CYAN, BLACK); mbse_colour(CYAN, BLACK);
printf("\r .. %-40s", Name); printf("\r .. %-40s", Name);
fflush(stdout); fflush(stdout);
} }
snprintf(sAreas, PATH_MAX -1, "%s/%s/mailbox", CFG.bbs_usersdir, usrconfig.Name); snprintf(sAreas, PATH_MAX, "%s/%s/mailbox", CFG.bbs_usersdir, usrconfig.Name);
are_tot++; are_tot++;
processed = FALSE; processed = FALSE;
if (do_kill) if (do_kill)
@ -360,7 +360,7 @@ void DoMsgBase()
LinkArea(sAreas, 0); LinkArea(sAreas, 0);
if (processed) if (processed)
are_proc++; are_proc++;
snprintf(sAreas, PATH_MAX -1, "%s/%s/archive", CFG.bbs_usersdir, usrconfig.Name); snprintf(sAreas, PATH_MAX, "%s/%s/archive", CFG.bbs_usersdir, usrconfig.Name);
snprintf(Name, 80, "User %s email area: archive", usrconfig.Name); snprintf(Name, 80, "User %s email area: archive", usrconfig.Name);
are_tot++; are_tot++;
processed = FALSE; processed = FALSE;
@ -373,7 +373,7 @@ void DoMsgBase()
LinkArea(sAreas, 0); LinkArea(sAreas, 0);
if (processed) if (processed)
are_proc++; are_proc++;
snprintf(sAreas, PATH_MAX -1, "%s/%s/trash", CFG.bbs_usersdir, usrconfig.Name); snprintf(sAreas, PATH_MAX, "%s/%s/trash", CFG.bbs_usersdir, usrconfig.Name);
snprintf(Name, 80, "User %s email area: trash", usrconfig.Name); snprintf(Name, 80, "User %s email area: trash", usrconfig.Name);
are_tot++; are_tot++;
processed = FALSE; processed = FALSE;

View File

@ -106,7 +106,7 @@ void WriteMailGroups(FILE *fp, faddr *f)
fgetpos(fi,&fileptr); fgetpos(fi,&fileptr);
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
if ((gp = fopen(temp, "r")) == NULL) { if ((gp = fopen(temp, "r")) == NULL) {
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
@ -165,7 +165,7 @@ void WriteFileGroups(FILE *fp, faddr *f)
fgetpos(fi,&fileptr); fgetpos(fi,&fileptr);
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
if ((gp = fopen(temp, "r")) == NULL) { if ((gp = fopen(temp, "r")) == NULL) {
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
@ -312,14 +312,14 @@ int UplinkRequest(faddr *t, faddr *From, int FileMgr, char *cmd)
Orig.net = From->net; Orig.net = From->net;
Orig.node = From->node; Orig.node = From->node;
Orig.point = From->point; Orig.point = From->point;
snprintf(Orig.domain, 12, "%s", From->domain); snprintf(Orig.domain, 13, "%s", From->domain);
memset(&Dest, 0, sizeof(Dest)); memset(&Dest, 0, sizeof(Dest));
Dest.zone = t->zone; Dest.zone = t->zone;
Dest.net = t->net; Dest.net = t->net;
Dest.node = t->node; Dest.node = t->node;
Dest.point = t->point; Dest.point = t->point;
snprintf(Dest.domain, 12, "%s", t->domain); snprintf(Dest.domain, 13, "%s", t->domain);
if (!SearchNode(Dest)) { if (!SearchNode(Dest)) {
Syslog('+', "Can't find node %s in setup", aka2str(Dest)); Syslog('+', "Can't find node %s in setup", aka2str(Dest));
@ -365,13 +365,13 @@ int UplinkRequest(faddr *t, faddr *From, int FileMgr, char *cmd)
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (nodes.PackNetmail) if (nodes.PackNetmail)
snprintf(ext, 3, (char *)"qqq"); snprintf(ext, 4, (char *)"qqq");
else if (nodes.Crash) else if (nodes.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else if (nodes.Hold) else if (nodes.Hold)
snprintf(ext, 3, (char *)"hhh"); snprintf(ext, 4, (char *)"hhh");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
if ((qp = OpenPkt(Orig, Dest, (char *)ext)) == NULL) if ((qp = OpenPkt(Orig, Dest, (char *)ext)) == NULL)
return 4; return 4;
@ -542,7 +542,7 @@ int Areas(void)
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
buf = calloc(4097, sizeof(char)); buf = calloc(4097, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
if ((gp = fopen(temp, "r")) == NULL) { if ((gp = fopen(temp, "r")) == NULL) {
WriteError("Can't open %s", temp); WriteError("Can't open %s", temp);
} else { } else {
@ -557,7 +557,7 @@ int Areas(void)
fflush(stdout); fflush(stdout);
} }
Syslog('+', "Checking mail group %s, file %s", mgroup.Name, mgroup.AreaFile); Syslog('+', "Checking mail group %s, file %s", mgroup.Name, mgroup.AreaFile);
snprintf(temp, PATH_MAX -1, "%s/%s", CFG.alists_path, mgroup.AreaFile); snprintf(temp, PATH_MAX, "%s/%s", CFG.alists_path, mgroup.AreaFile);
if ((ap = fopen(temp, "r")) == NULL) { if ((ap = fopen(temp, "r")) == NULL) {
WriteError("Can't open %s", temp); WriteError("Can't open %s", temp);
} else { } else {
@ -577,7 +577,7 @@ int Areas(void)
printf("(check missing areas)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); printf("(check missing areas)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
fflush(stdout); fflush(stdout);
} }
snprintf(temp, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
WriteError("Can't open %s", temp); WriteError("Can't open %s", temp);
tidy_arealist(&alist); tidy_arealist(&alist);
@ -652,7 +652,7 @@ int Areas(void)
* the area is set to read-only and all links are disconnected. * the area is set to read-only and all links are disconnected.
* If the area is empty, it is removed from the setup. * If the area is empty, it is removed from the setup.
*/ */
snprintf(temp, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r+")) == NULL) { if ((fp = fopen(temp, "r+")) == NULL) {
WriteError("Can't open %s for r/w"); WriteError("Can't open %s for r/w");
} else { } else {
@ -666,12 +666,12 @@ int Areas(void)
while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) {
if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) { if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) {
fseek(fp, - msgshdr.recsize, SEEK_CUR); fseek(fp, - msgshdr.recsize, SEEK_CUR);
snprintf(temp, PATH_MAX -1, "%s.jhr", msgs.Base); snprintf(temp, PATH_MAX, "%s.jhr", msgs.Base);
if (strlen(msgs.Base) && (file_size(temp) != 1024)) { if (strlen(msgs.Base) && (file_size(temp) != 1024)) {
Mgrlog("Marking echo %s, group %s, area %d read-only", msgs.Tag, mgroup.Name, Mgrlog("Marking echo %s, group %s, area %d read-only", msgs.Tag, mgroup.Name,
((ftell(fp) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize)) + 1); ((ftell(fp) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize)) + 1);
msgs.MsgKinds = RONLY; // Area read-only msgs.MsgKinds = RONLY; // Area read-only
snprintf(msgs.Group, 12, "DELETED"); // Make groupname invalid snprintf(msgs.Group, 13, "DELETED"); // Make groupname invalid
} else { } else {
Mgrlog("Removing empty echo %s, group %s, area %d", msgs.Tag, mgroup.Name, Mgrlog("Removing empty echo %s, group %s, area %d", msgs.Tag, mgroup.Name,
((ftell(fp) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize)) + 1); ((ftell(fp) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize)) + 1);
@ -740,7 +740,7 @@ int Areas(void)
fclose(gp); fclose(gp);
} }
snprintf(temp, PATH_MAX -1, "%s/etc/fgroups.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
if ((gp = fopen(temp, "r")) == NULL) { if ((gp = fopen(temp, "r")) == NULL) {
WriteError("Can't open %s", temp); WriteError("Can't open %s", temp);
} else { } else {
@ -755,7 +755,7 @@ int Areas(void)
fflush(stdout); fflush(stdout);
} }
Syslog('+', "Checking tic group %s, file %s", fgroup.Name, fgroup.AreaFile); Syslog('+', "Checking tic group %s, file %s", fgroup.Name, fgroup.AreaFile);
snprintf(temp, PATH_MAX -1, "%s/%s", CFG.alists_path, fgroup.AreaFile); snprintf(temp, PATH_MAX, "%s/%s", CFG.alists_path, fgroup.AreaFile);
if ((ap = fopen(temp, "r")) == NULL) { if ((ap = fopen(temp, "r")) == NULL) {
WriteError("Can't open %s", temp); WriteError("Can't open %s", temp);
} else { } else {
@ -819,7 +819,7 @@ int Areas(void)
printf("(check missing areas)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); printf("(check missing areas)\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
fflush(stdout); fflush(stdout);
} }
snprintf(temp, PATH_MAX -1, "%s/etc/tic.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/tic.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
WriteError("Can't open %s", temp); WriteError("Can't open %s", temp);
tidy_arealist(&alist); tidy_arealist(&alist);
@ -896,7 +896,7 @@ int Areas(void)
* still warned about that by the "mbfile check" command. * still warned about that by the "mbfile check" command.
*/ */
Found = FALSE; Found = FALSE;
snprintf(temp, PATH_MAX -1, "%s/etc/tic.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/tic.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r+")) == NULL) { if ((fp = fopen(temp, "r+")) == NULL) {
WriteError("Can't open %s for r/w"); WriteError("Can't open %s for r/w");
} else { } else {

View File

@ -43,8 +43,8 @@ void mover(char *fn)
From = calloc(PATH_MAX, sizeof(char)); From = calloc(PATH_MAX, sizeof(char));
To = calloc(PATH_MAX, sizeof(char)); To = calloc(PATH_MAX, sizeof(char));
snprintf(From, PATH_MAX -1, "%s/%s", TIC.Inbound, fn); snprintf(From, PATH_MAX, "%s/%s", TIC.Inbound, fn);
snprintf(To, PATH_MAX -1, "%s/%s", CFG.badtic, fn); snprintf(To, PATH_MAX, "%s/%s", CFG.badtic, fn);
Syslog('!', "Moving %s to %s", From, To); Syslog('!', "Moving %s to %s", From, To);
if (mkdirs(To, 0770)) { if (mkdirs(To, 0770)) {

View File

@ -114,7 +114,7 @@ int toss_onemsg(char *msgname)
net_msgs++; net_msgs++;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/%s", CFG.msgs_path, msgname); snprintf(temp, PATH_MAX, "%s/%s", CFG.msgs_path, msgname);
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
@ -315,7 +315,7 @@ int toss_onemsg(char *msgname)
(strncasecmp(toUserName, "postmaster", 10) == 0) || (strncasecmp(toUserName, "postmaster", 10) == 0) ||
(strncasecmp(toUserName, "coordinator", 11) == 0)) { (strncasecmp(toUserName, "coordinator", 11) == 0)) {
Syslog('+', " Readdress from %s to %s", toUserName, CFG.sysop_name); Syslog('+', " Readdress from %s to %s", toUserName, CFG.sysop_name);
snprintf(toUserName, 36, "%s", CFG.sysop_name); snprintf(toUserName, 37, "%s", CFG.sysop_name);
strcpy(Msg.To, toUserName); strcpy(Msg.To, toUserName);
} }
net_imp++; net_imp++;
@ -328,19 +328,19 @@ int toss_onemsg(char *msgname)
Msg.Netmail = TRUE; Msg.Netmail = TRUE;
if (origPoint) if (origPoint)
snprintf(Msg.FromAddress, 100, "%d:%d/%d.%d@%s", origZone, origNet, origNode, origPoint, fidonet.domain); snprintf(Msg.FromAddress, 101, "%d:%d/%d.%d@%s", origZone, origNet, origNode, origPoint, fidonet.domain);
else else
snprintf(Msg.FromAddress, 100, "%d:%d/%d@%s", origZone, origNet, origNode, fidonet.domain); snprintf(Msg.FromAddress, 101, "%d:%d/%d@%s", origZone, origNet, origNode, fidonet.domain);
if (SearchFidonet(destZone)) { if (SearchFidonet(destZone)) {
if (destPoint) if (destPoint)
snprintf(Msg.ToAddress, 100, "%d:%d/%d.%d@%s", destZone, destNet, destNode, destPoint, fidonet.domain); snprintf(Msg.ToAddress, 101, "%d:%d/%d.%d@%s", destZone, destNet, destNode, destPoint, fidonet.domain);
else else
snprintf(Msg.ToAddress, 100, "%d:%d/%d@%s", destZone, destNet, destNode, fidonet.domain); snprintf(Msg.ToAddress, 101, "%d:%d/%d@%s", destZone, destNet, destNode, fidonet.domain);
} else { } else {
if (destPoint) if (destPoint)
snprintf(Msg.ToAddress, 100, "%d:%d/%d.%d", destZone, destNet, destNode, destPoint); snprintf(Msg.ToAddress, 101, "%d:%d/%d.%d", destZone, destNet, destNode, destPoint);
else else
snprintf(Msg.ToAddress, 100, "%d:%d/%d", destZone, destNet, destNode); snprintf(Msg.ToAddress, 101, "%d:%d/%d", destZone, destNet, destNode);
} }
/* /*
@ -367,7 +367,7 @@ int toss_onemsg(char *msgname)
if (!islocal) { if (!islocal) {
do_scan = TRUE; do_scan = TRUE;
snprintf(temp, PATH_MAX -1, "%s/tmp/netmail.jam", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((np = fopen(temp, "a")) != NULL) { if ((np = fopen(temp, "a")) != NULL) {
fprintf(np, "%s %lu\n", msgs.Base, Msg.Id); fprintf(np, "%s %lu\n", msgs.Base, Msg.Id);
fclose(np); fclose(np);
@ -385,7 +385,7 @@ int toss_onemsg(char *msgname)
if (rc == 0) { if (rc == 0) {
net_in++; net_in++;
snprintf(temp, PATH_MAX -1, "%s/%s", CFG.msgs_path, msgname); snprintf(temp, PATH_MAX, "%s/%s", CFG.msgs_path, msgname);
if (unlink(temp) != 0) if (unlink(temp) != 0)
WriteError("Can't remove %s", temp); WriteError("Can't remove %s", temp);
} }

View File

@ -72,7 +72,7 @@ void Msg_Id(fidoaddr aka)
unsigned long crc = -1; unsigned long crc = -1;
temp = calloc(81, sizeof(char)); temp = calloc(81, sizeof(char));
snprintf(temp, 80, "\001MSGID: %s %08lx", aka2str(aka), sequencer()); snprintf(temp, 81, "\001MSGID: %s %08lx", aka2str(aka), sequencer());
MsgText_Add2(temp); MsgText_Add2(temp);
Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp)); Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp));
Msg.ReplyCRC = 0xffffffff; Msg.ReplyCRC = 0xffffffff;
@ -87,16 +87,16 @@ void Msg_Pid(void)
time_t tt; time_t tt;
temp = calloc(81, sizeof(char)); temp = calloc(81, sizeof(char));
snprintf(temp, 80, "\001PID: MBSE-FIDO %s (%s-%s)", VERSION, OsName(), OsCPU()); snprintf(temp, 81, "\001PID: MBSE-FIDO %s (%s-%s)", VERSION, OsName(), OsCPU());
MsgText_Add2(temp); MsgText_Add2(temp);
if (msgs.Charset != FTNC_NONE) { if (msgs.Charset != FTNC_NONE) {
snprintf(temp, 80, "\001CHRS: %s", getftnchrs(msgs.Charset)); snprintf(temp, 81, "\001CHRS: %s", getftnchrs(msgs.Charset));
} else { } else {
snprintf(temp, 80, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1)); snprintf(temp, 81, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1));
} }
MsgText_Add2(temp); MsgText_Add2(temp);
tt = time(NULL); tt = time(NULL);
snprintf(temp, 80, "\001TZUTC: %s", gmtoffset(tt)); snprintf(temp, 81, "\001TZUTC: %s", gmtoffset(tt));
MsgText_Add2(temp); MsgText_Add2(temp);
free(temp); free(temp);
} }
@ -168,7 +168,7 @@ long Msg_Top(char *template, int language, fidoaddr aka)
hasmodems = TRUE; hasmodems = TRUE;
} }
snprintf(temp, PATH_MAX -1, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/ttyinfo.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) != NULL) { if ((fp = fopen(temp, "r")) != NULL) {
fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp); fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp);
while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) { while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) {
@ -220,11 +220,11 @@ void Msg_Bot(fidoaddr UseAka, char *Org, char *template)
MsgText_Add2(TearLine()); MsgText_Add2(TearLine());
if (UseAka.point) if (UseAka.point)
snprintf(aka, 39, "(%d:%d/%d.%d)", UseAka.zone, UseAka.net, UseAka.node, UseAka.point); snprintf(aka, 40, "(%d:%d/%d.%d)", UseAka.zone, UseAka.net, UseAka.node, UseAka.point);
else else
snprintf(aka, 39, "(%d:%d/%d)", UseAka.zone, UseAka.net, UseAka.node); snprintf(aka, 40, "(%d:%d/%d)", UseAka.zone, UseAka.net, UseAka.node);
snprintf(temp, 80, " * Origin: %s %s", Org, aka); snprintf(temp, 81, " * Origin: %s %s", Org, aka);
MsgText_Add2(temp); MsgText_Add2(temp);
free(aka); free(aka);
free(temp); free(temp);
@ -238,7 +238,7 @@ void CountPosted(char *Base)
FILE *fp; FILE *fp;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r+")) != NULL) { if ((fp = fopen(temp, "r+")) != NULL) {
fread(&msgshdr, sizeof(msgshdr), 1, fp); fread(&msgshdr, sizeof(msgshdr), 1, fp);

View File

@ -60,7 +60,7 @@ int newspost(void)
* a file, try to post the articles. They may be * a file, try to post the articles. They may be
* still here if the newsserver wasn't available. * still here if the newsserver wasn't available.
*/ */
snprintf(buf, 10239, "%s/tmp/newsout", getenv("MBSE_ROOT")); snprintf(buf, 10240, "%s/tmp/newsout", getenv("MBSE_ROOT"));
if ((nfp = fopen(buf, "r")) == NULL) { if ((nfp = fopen(buf, "r")) == NULL) {
if (newsopen) if (newsopen)
WriteError("$Can't reopen %s", buf); WriteError("$Can't reopen %s", buf);
@ -115,7 +115,7 @@ int newspost(void)
*/ */
if ((CFG.newsfeed == FEEDUUCP) || (CFG.newsfeed == FEEDRNEWS)) { if ((CFG.newsfeed == FEEDUUCP) || (CFG.newsfeed == FEEDRNEWS)) {
Syslog('+', "Posting news articles to the news batchfile"); Syslog('+', "Posting news articles to the news batchfile");
snprintf(buf, 10239, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); snprintf(buf, 10240, "%s/tmp/newsbatch", getenv("MBSE_ROOT"));
if ((ofp = fopen(buf, "w+")) == NULL) { if ((ofp = fopen(buf, "w+")) == NULL) {
WriteError("$Can't create %s", buf); WriteError("$Can't create %s", buf);
free(buf); free(buf);
@ -178,7 +178,7 @@ int newspost(void)
} else } else
Syslog('+', "Articles send through %s", CFG.rnewspath); Syslog('+', "Articles send through %s", CFG.rnewspath);
fclose(ofp); fclose(ofp);
snprintf(buf, 10239, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); snprintf(buf, 10240, "%s/tmp/newsbatch", getenv("MBSE_ROOT"));
unlink(buf); unlink(buf);
} }
@ -194,7 +194,7 @@ int newspost(void)
return TRUE; return TRUE;
} }
snprintf(buf, 10239, "%s/C.%s%lx", CFG.rnewspath, CFG.nntpnode, seqnr); snprintf(buf, 10240, "%s/C.%s%lx", CFG.rnewspath, CFG.nntpnode, seqnr);
if ((nb = fopen(buf, "a")) == NULL) { if ((nb = fopen(buf, "a")) == NULL) {
WriteError("Can't create %s", buf); WriteError("Can't create %s", buf);
newsopen = FALSE; newsopen = FALSE;
@ -204,7 +204,7 @@ int newspost(void)
fprintf(nb, "E D.%s%lx D.%s%lx news -C D.%s%lx 0666 \"\" 0 rnews\n", fprintf(nb, "E D.%s%lx D.%s%lx news -C D.%s%lx 0666 \"\" 0 rnews\n",
utsbuf.nodename, seqnr, utsbuf.nodename, seqnr, utsbuf.nodename, seqnr); utsbuf.nodename, seqnr, utsbuf.nodename, seqnr, utsbuf.nodename, seqnr);
fclose(nb); fclose(nb);
snprintf(buf, 10239, "%s/D.%s%lx", CFG.rnewspath, utsbuf.nodename, seqnr); snprintf(buf, 10240, "%s/D.%s%lx", CFG.rnewspath, utsbuf.nodename, seqnr);
if ((nb = fopen(buf, "a")) == NULL) { if ((nb = fopen(buf, "a")) == NULL) {
WriteError("Can't create %s", buf); WriteError("Can't create %s", buf);
newsopen = FALSE; newsopen = FALSE;
@ -215,12 +215,12 @@ int newspost(void)
} }
Syslog('+', "Articles placed in %s", CFG.rnewspath); Syslog('+', "Articles placed in %s", CFG.rnewspath);
fclose(ofp); fclose(ofp);
snprintf(buf, 10239, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); snprintf(buf, 10240, "%s/tmp/newsbatch", getenv("MBSE_ROOT"));
unlink(buf); unlink(buf);
} }
if (! news_bad) { if (! news_bad) {
snprintf(buf, 10239, "%s/tmp/newsout", getenv("MBSE_ROOT")); snprintf(buf, 10240, "%s/tmp/newsout", getenv("MBSE_ROOT"));
unlink(buf); unlink(buf);
} }

View File

@ -68,7 +68,7 @@ int Notify(char *Options)
} }
if (strlen(Options)) { if (strlen(Options)) {
snprintf(Opt, 43, "%s~", Options); snprintf(Opt, 44, "%s~", Options);
if (strchr(Opt, '.') != NULL) { if (strchr(Opt, '.') != NULL) {
temp = strdup(strtok(Opt, ":")); temp = strdup(strtok(Opt, ":"));
if (atoi(temp)) if (atoi(temp))
@ -112,7 +112,7 @@ int Notify(char *Options)
Syslog('m', "Parsing nodes %d:%d/%d.%d", Zones, Nets, Nodes, Points); Syslog('m', "Parsing nodes %d:%d/%d.%d", Zones, Nets, Nodes, Points);
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/nodes.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/nodes.data", getenv("MBSE_ROOT"));
if ((np = fopen(temp, "r")) == NULL) { if ((np = fopen(temp, "r")) == NULL) {
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
return FALSE; return FALSE;

View File

@ -69,7 +69,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
} }
sAreas = calloc(PATH_MAX, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
snprintf(sAreas, PATH_MAX -1, "%s//etc/mareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((fp = fopen(sAreas, "r")) == NULL) { if ((fp = fopen(sAreas, "r")) == NULL) {
WriteError("$Can't open %s", sAreas); WriteError("$Can't open %s", sAreas);
free(sAreas); free(sAreas);
@ -163,8 +163,8 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
/* /*
* Start writing the message * Start writing the message
*/ */
snprintf(Msg.From, 100, CFG.sysop_name); snprintf(Msg.From, 101, CFG.sysop_name);
snprintf(Msg.To, 100, To); snprintf(Msg.To, 101, To);
/* /*
* If netmail, clean the To field. * If netmail, clean the To field.
@ -180,8 +180,8 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
} }
} }
snprintf(Msg.Subject, 100, "%s", Subj); snprintf(Msg.Subject, 101, "%s", Subj);
snprintf(Msg.FromAddress, 100, "%s", aka2str(msgs.Aka)); snprintf(Msg.FromAddress, 101, "%s", aka2str(msgs.Aka));
Msg.Written = time(NULL); Msg.Written = time(NULL);
Msg.Arrived = time(NULL); Msg.Arrived = time(NULL);
Msg.Local = TRUE; Msg.Local = TRUE;
@ -200,7 +200,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
case NETMAIL: case NETMAIL:
Msg.Netmail = TRUE; Msg.Netmail = TRUE;
snprintf(Msg.ToAddress, 100, "%s", ascfnode(parsefaddr(To), 0xff)); snprintf(Msg.ToAddress, 101, "%s", ascfnode(parsefaddr(To), 0xff));
break; break;
case ECHOMAIL: case ECHOMAIL:
@ -213,22 +213,22 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
} }
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "\001MSGID: %s %08lx", aka2str(msgs.Aka), sequencer()); snprintf(temp, PATH_MAX, "\001MSGID: %s %08lx", aka2str(msgs.Aka), sequencer());
MsgText_Add2(temp); MsgText_Add2(temp);
Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp)); Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp));
Msg.ReplyCRC = 0xffffffff; Msg.ReplyCRC = 0xffffffff;
snprintf(temp, PATH_MAX -1, "\001PID: MBSE-FIDO %s (%s-%s)", VERSION, OsName(), OsCPU()); snprintf(temp, PATH_MAX, "\001PID: MBSE-FIDO %s (%s-%s)", VERSION, OsName(), OsCPU());
MsgText_Add2(temp); MsgText_Add2(temp);
if (msgs.Charset != FTNC_NONE) { if (msgs.Charset != FTNC_NONE) {
snprintf(temp, PATH_MAX -1, "\001CHRS: %s", getftnchrs(msgs.Charset)); snprintf(temp, PATH_MAX, "\001CHRS: %s", getftnchrs(msgs.Charset));
} else { } else {
snprintf(temp, PATH_MAX -1, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1)); snprintf(temp, PATH_MAX, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1));
} }
MsgText_Add2(temp); MsgText_Add2(temp);
snprintf(temp, PATH_MAX -1, "\001TZUTC: %s", gmtoffset(tt)); snprintf(temp, PATH_MAX, "\001TZUTC: %s", gmtoffset(tt));
MsgText_Add2(temp); MsgText_Add2(temp);
while ((Fgets(temp, PATH_MAX -1, tp)) != NULL) { while ((Fgets(temp, PATH_MAX, tp)) != NULL) {
if (strncmp(temp, "--- ", 4) == 0) if (strncmp(temp, "--- ", 4) == 0)
has_tear = TRUE; has_tear = TRUE;
if (strncmp(temp, " * Origin: ", 11) == 0) if (strncmp(temp, " * Origin: ", 11) == 0)
@ -255,14 +255,14 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
aka = calloc(40, sizeof(char)); aka = calloc(40, sizeof(char));
if (msgs.Aka.point) if (msgs.Aka.point)
snprintf(aka, 39, "(%d:%d/%d.%d)", msgs.Aka.zone, msgs.Aka.net, msgs.Aka.node, msgs.Aka.point); snprintf(aka, 40, "(%d:%d/%d.%d)", msgs.Aka.zone, msgs.Aka.net, msgs.Aka.node, msgs.Aka.point);
else else
snprintf(aka, 39, "(%d:%d/%d)", msgs.Aka.zone, msgs.Aka.net, msgs.Aka.node); snprintf(aka, 40, "(%d:%d/%d)", msgs.Aka.zone, msgs.Aka.net, msgs.Aka.node);
if (strlen(msgs.Origin)) if (strlen(msgs.Origin))
snprintf(temp, 80, " * Origin: %s %s", msgs.Origin, aka); snprintf(temp, 81, " * Origin: %s %s", msgs.Origin, aka);
else else
snprintf(temp, 80, " * Origin: %s %s", CFG.origin, aka); snprintf(temp, 81, " * Origin: %s %s", CFG.origin, aka);
MsgText_Add2(temp); MsgText_Add2(temp);
free(aka); free(aka);
@ -273,7 +273,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor)
Syslog('+', "Posted message %ld", Msg.Id); Syslog('+', "Posted message %ld", Msg.Id);
if (msgs.Type != LOCALMAIL) { if (msgs.Type != LOCALMAIL) {
snprintf(temp, PATH_MAX -1, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"), (msgs.Type == ECHOMAIL) ? "echo" : "net"); snprintf(temp, PATH_MAX, "%s/tmp/%smail.jam", getenv("MBSE_ROOT"), (msgs.Type == ECHOMAIL) ? "echo" : "net");
if ((fp = fopen(temp, "a")) != NULL) { if ((fp = fopen(temp, "a")) != NULL) {
fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id); fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id);
fclose(fp); fclose(fp);

View File

@ -79,13 +79,13 @@ int EchoOut(fidoaddr aka, char *toname, char *fromname, char *subj, FILE *fp, in
*/ */
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (nodes.PackNetmail) if (nodes.PackNetmail)
snprintf(ext, 3, (char *)"qqq"); snprintf(ext, 4, (char *)"qqq");
else if (nodes.Crash) else if (nodes.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else if (nodes.Hold) else if (nodes.Hold)
snprintf(ext, 3, (char *)"hhh"); snprintf(ext, 4, (char *)"hhh");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
if ((qp = OpenPkt(msgs.Aka, aka, (char *)ext)) == NULL) { if ((qp = OpenPkt(msgs.Aka, aka, (char *)ext)) == NULL) {
WriteError("EchoOut(): OpenPkt failed"); WriteError("EchoOut(): OpenPkt failed");
@ -346,7 +346,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
*/ */
Syslog('m', "Gated echomail, clean SB"); Syslog('m', "Gated echomail, clean SB");
tidy_falist(&sbl); tidy_falist(&sbl);
snprintf(sbe, 15, "%u/%u", Link.aka.net, Link.aka.node); snprintf(sbe, 16, "%u/%u", Link.aka.net, Link.aka.node);
Syslog('m', "Add gate SB %s", sbe); Syslog('m', "Add gate SB %s", sbe);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
@ -358,7 +358,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
for (i = 0; i < 40; i++) { for (i = 0; i < 40; i++) {
if (CFG.akavalid[i] && (msgs.Aka.zone == CFG.aka[i].zone) && (CFG.aka[i].point == 0) && if (CFG.akavalid[i] && (msgs.Aka.zone == CFG.aka[i].zone) && (CFG.aka[i].point == 0) &&
!((msgs.Aka.net == CFG.aka[i].net) && (msgs.Aka.node == CFG.aka[i].node))) { !((msgs.Aka.net == CFG.aka[i].net) && (msgs.Aka.node == CFG.aka[i].node))) {
snprintf(sbe, 15, "%u/%u", CFG.aka[i].net, CFG.aka[i].node); snprintf(sbe, 16, "%u/%u", CFG.aka[i].net, CFG.aka[i].node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
} }
@ -368,7 +368,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
/* /*
* Add our system to the path for later export. * Add our system to the path for later export.
*/ */
snprintf(sbe, 15, "%u/%u", msgs.Aka.net, msgs.Aka.node); snprintf(sbe, 16, "%u/%u", msgs.Aka.net, msgs.Aka.node);
fill_path(&ptl, sbe); fill_path(&ptl, sbe);
uniq_list(&ptl); /* remove possible duplicate own aka */ uniq_list(&ptl); /* remove possible duplicate own aka */
@ -399,7 +399,7 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
*/ */
for (tmpq = qal; tmpq; tmpq = tmpq->next) { for (tmpq = qal; tmpq; tmpq = tmpq->next) {
if (tmpq->send) { if (tmpq->send) {
snprintf(sbe, 15, "%u/%u", tmpq->aka.net, tmpq->aka.node); snprintf(sbe, 16, "%u/%u", tmpq->aka.net, tmpq->aka.node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
} }
@ -437,15 +437,15 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
oldnet = sbl->addr->net - 1; oldnet = sbl->addr->net - 1;
for (tmpl = sbl; tmpl; tmpl = tmpl->next) { for (tmpl = sbl; tmpl; tmpl = tmpl->next) {
if (tmpl->addr->net == oldnet) if (tmpl->addr->net == oldnet)
snprintf(sbe, 15, " %u", tmpl->addr->node); snprintf(sbe, 16, " %u", tmpl->addr->node);
else else
snprintf(sbe, 15, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 16, " %u/%u", tmpl->addr->net, tmpl->addr->node);
oldnet = tmpl->addr->net; oldnet = tmpl->addr->net;
seenlen += strlen(sbe); seenlen += strlen(sbe);
if (seenlen > MAXSEEN) { if (seenlen > MAXSEEN) {
seenlen = 0; seenlen = 0;
fprintf(nfp, "\nSEEN-BY:"); fprintf(nfp, "\nSEEN-BY:");
snprintf(sbe, 15, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 16, " %u/%u", tmpl->addr->net, tmpl->addr->node);
seenlen = strlen(sbe); seenlen = strlen(sbe);
} }
fprintf(nfp, "%s", sbe); fprintf(nfp, "%s", sbe);
@ -458,15 +458,15 @@ int postecho(faddr *p_from, faddr *f, faddr *t, char *orig, char *subj, time_t m
oldnet = ptl->addr->net - 1; oldnet = ptl->addr->net - 1;
for (tmpl = ptl; tmpl; tmpl = tmpl->next) { for (tmpl = ptl; tmpl; tmpl = tmpl->next) {
if (tmpl->addr->net == oldnet) if (tmpl->addr->net == oldnet)
snprintf(sbe, 15, " %u", tmpl->addr->node); snprintf(sbe, 16, " %u", tmpl->addr->node);
else else
snprintf(sbe, 15, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 16, " %u/%u", tmpl->addr->net, tmpl->addr->node);
oldnet = tmpl->addr->net; oldnet = tmpl->addr->net;
seenlen += strlen(sbe); seenlen += strlen(sbe);
if (seenlen > MAXPATH) { if (seenlen > MAXPATH) {
seenlen = 0; seenlen = 0;
fprintf(nfp, "\n\001PATH:"); fprintf(nfp, "\n\001PATH:");
snprintf(sbe, 15, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 16, " %u/%u", tmpl->addr->net, tmpl->addr->node);
seenlen = strlen(sbe); seenlen = strlen(sbe);
} }
fprintf(nfp, "%s", sbe); fprintf(nfp, "%s", sbe);

View File

@ -247,7 +247,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
na.node = t->node; na.node = t->node;
na.point = t->point; na.point = t->point;
if (SearchFidonet(na.zone)) if (SearchFidonet(na.zone))
snprintf(na.domain, 12, "%s", fidonet.domain); snprintf(na.domain, 13, "%s", fidonet.domain);
switch(TrackMail(na, &routeto)) { switch(TrackMail(na, &routeto)) {
case R_LOCAL: case R_LOCAL:
@ -288,7 +288,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
*/ */
(void)noderecord(f); (void)noderecord(f);
p = calloc(PATH_MAX, sizeof(char)); p = calloc(PATH_MAX, sizeof(char));
snprintf(p, PATH_MAX -1, "%s/etc/service.data", getenv("MBSE_ROOT")); snprintf(p, PATH_MAX, "%s/etc/service.data", getenv("MBSE_ROOT"));
if ((sfp = fopen(p, "r")) == NULL) { if ((sfp = fopen(p, "r")) == NULL) {
WriteError("$Can't open %s", p); WriteError("$Can't open %s", p);
} else { } else {
@ -374,13 +374,13 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (nodes.PackNetmail) if (nodes.PackNetmail)
snprintf(ext, 3, (char *)"qqq"); snprintf(ext, 4, (char *)"qqq");
else if (nodes.Crash) else if (nodes.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else if (nodes.Hold) else if (nodes.Hold)
snprintf(ext, 3, (char *)"hhh"); snprintf(ext, 4, (char *)"hhh");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
if ((net = OpenPkt(Orig , routeto, (char *)ext)) == NULL) { if ((net = OpenPkt(Orig , routeto, (char *)ext)) == NULL) {
net_bad++; net_bad++;

View File

@ -101,7 +101,7 @@ int ProcessTic(fa_list **sbl)
/* /*
* Now check the age of the .tic file. * Now check the age of the .tic file.
*/ */
snprintf(Temp, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicName); snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicName);
Fdate = file_time(Temp); Fdate = file_time(Temp);
Age = (Now - Fdate) / 84400; Age = (Now - Fdate) / 84400;
Syslog('+', "Orphaned tic age %d days", Age); Syslog('+', "Orphaned tic age %d days", Age);
@ -115,7 +115,7 @@ int ProcessTic(fa_list **sbl)
return 2; return 2;
} }
snprintf(Temp, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
crc = file_crc(Temp, CFG.slow_util && do_quiet); crc = file_crc(Temp, CFG.slow_util && do_quiet);
TIC.FileSize = file_size(Temp); TIC.FileSize = file_size(Temp);
TIC.FileDate = file_time(Temp); TIC.FileDate = file_time(Temp);
@ -210,7 +210,7 @@ int ProcessTic(fa_list **sbl)
} }
if (Magic_DeleteFile()) { if (Magic_DeleteFile()) {
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicName); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicName);
file_rm(temp1); file_rm(temp1);
Syslog('+', "Deleted file %s", temp1); Syslog('+', "Deleted file %s", temp1);
file_rm(Temp); file_rm(Temp);
@ -238,7 +238,7 @@ int ProcessTic(fa_list **sbl)
strcpy(TIC.BBSpath, CFG.ticout); strcpy(TIC.BBSpath, CFG.ticout);
strcpy(TIC.BBSdesc, tic.Comment); strcpy(TIC.BBSdesc, tic.Comment);
} else { } else {
snprintf(Temp, PATH_MAX -1, "%s/etc/fareas.data", getenv("MBSE_ROOT")); snprintf(Temp, PATH_MAX, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
if ((fp = fopen(Temp, "r")) == NULL) { if ((fp = fopen(Temp, "r")) == NULL) {
WriteError("Can't access fareas.data area: %ld", tic.FileArea); WriteError("Can't access fareas.data area: %ld", tic.FileArea);
free(Temp); free(Temp);
@ -282,7 +282,7 @@ int ProcessTic(fa_list **sbl)
} }
if ((tic.DupCheck) && (check_dupe)) { if ((tic.DupCheck) && (check_dupe)) {
snprintf(Temp, PATH_MAX -1, "%s%s", TIC.TicIn.Area, TIC.TicIn.Crc); snprintf(Temp, PATH_MAX, "%s%s", TIC.TicIn.Area, TIC.TicIn.Crc);
crc2 = 0xffffffff; crc2 = 0xffffffff;
crc2 = upd_crc32(Temp, crc2, strlen(Temp)); crc2 = upd_crc32(Temp, crc2, strlen(Temp));
if (CheckDupe(crc2, D_FILEECHO, CFG.tic_dupes)) { if (CheckDupe(crc2, D_FILEECHO, CFG.tic_dupes)) {
@ -364,8 +364,8 @@ int ProcessTic(fa_list **sbl)
* it's a passthru area. * it's a passthru area.
*/ */
if (((tic.SendOrg) && (MustRearc || strlen(tic.Banner))) || (!tic.FileArea)) { if (((tic.SendOrg) && (MustRearc || strlen(tic.Banner))) || (!tic.FileArea)) {
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
snprintf(temp2, PATH_MAX -1, "%s/%s", CFG.ticout, TIC.TicIn.File); snprintf(temp2, PATH_MAX, "%s/%s", CFG.ticout, TIC.TicIn.File);
if ((rc = file_cp(temp1, temp2) == 0)) { if ((rc = file_cp(temp1, temp2) == 0)) {
TIC.SendOrg = TRUE; TIC.SendOrg = TRUE;
} else { } else {
@ -378,7 +378,7 @@ int ProcessTic(fa_list **sbl)
/* /*
* Check if there is a temp directory for the archive conversion. * Check if there is a temp directory for the archive conversion.
*/ */
snprintf(temp2, PATH_MAX -1, "%s/tmp/arc", getenv("MBSE_ROOT")); snprintf(temp2, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
if ((access(temp2, R_OK)) != 0) { if ((access(temp2, R_OK)) != 0) {
if (mkdir(temp2, 0777)) { if (mkdir(temp2, 0777)) {
WriteError("$Can't create %s", temp2); WriteError("$Can't create %s", temp2);
@ -391,16 +391,16 @@ int ProcessTic(fa_list **sbl)
/* /*
* Check for stale FILE_ID.DIZ files * Check for stale FILE_ID.DIZ files
*/ */
snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
if (!unlink(temp1)) if (!unlink(temp1))
Syslog('+', "Removed stale %s", temp1); Syslog('+', "Removed stale %s", temp1);
snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
if (!unlink(temp1)) if (!unlink(temp1))
Syslog('+', "Removed stale %s", temp1); Syslog('+', "Removed stale %s", temp1);
snprintf(temp1, PATH_MAX -1, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
if (!unlink(temp1)) if (!unlink(temp1))
Syslog('+', "Removed stale %s", temp1); Syslog('+', "Removed stale %s", temp1);
snprintf(temp1, PATH_MAX -1, "%s/tmp/file_id.diz", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp/file_id.diz", getenv("MBSE_ROOT"));
if (!unlink(temp1)) if (!unlink(temp1))
Syslog('+', "Removed stale %s", temp1); Syslog('+', "Removed stale %s", temp1);
@ -431,7 +431,7 @@ int ProcessTic(fa_list **sbl)
if ((cmd == NULL) || (cmd == "")) { if ((cmd == NULL) || (cmd == "")) {
Syslog('!', "No unarc command available"); Syslog('!', "No unarc command available");
} else { } else {
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
if (execute_str(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) { if (execute_str(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
UnPacked = TRUE; UnPacked = TRUE;
} else { } else {
@ -451,8 +451,8 @@ int ProcessTic(fa_list **sbl)
* whatever that is. This should catch single files * whatever that is. This should catch single files
* with worms or other macro viri * with worms or other macro viri
*/ */
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
snprintf(temp2, PATH_MAX -1, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File); snprintf(temp2, PATH_MAX, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File);
if ((rc = file_cp(temp1, temp2))) { if ((rc = file_cp(temp1, temp2))) {
WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc)); WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc));
@ -461,7 +461,7 @@ int ProcessTic(fa_list **sbl)
return 1; return 1;
} }
snprintf(temp2, PATH_MAX -1, "%s/tmp/arc", getenv("MBSE_ROOT")); snprintf(temp2, PATH_MAX, "%s/tmp/arc", getenv("MBSE_ROOT"));
if (chdir(temp2) != 0) { if (chdir(temp2) != 0) {
WriteError("$Can't change to %s", temp2); WriteError("$Can't change to %s", temp2);
free(Temp); free(Temp);
@ -495,12 +495,12 @@ int ProcessTic(fa_list **sbl)
if (tic.FileId && tic.FileArea && IsArchive) { if (tic.FileId && tic.FileArea && IsArchive) {
if (UnPacked) { if (UnPacked) {
snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT"));
snprintf(temp2, PATH_MAX -1, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
if (file_cp(temp1, temp2) == 0) { if (file_cp(temp1, temp2) == 0) {
File_Id = TRUE; File_Id = TRUE;
} else { } else {
snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT"));
if (file_cp(temp1, temp2) == 0) { if (file_cp(temp1, temp2) == 0) {
File_Id = TRUE; File_Id = TRUE;
} }
@ -514,13 +514,13 @@ int ProcessTic(fa_list **sbl)
if (cmd == NULL) { if (cmd == NULL) {
WriteError("No unarc command available"); WriteError("No unarc command available");
} else { } else {
snprintf(temp1, PATH_MAX -1, "%s/tmp", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT"));
chdir(temp1); chdir(temp1);
snprintf(temp1, PATH_MAX -1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.TicIn.File); snprintf(temp1, PATH_MAX, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.TicIn.File);
if (execute_str(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) { if (execute_str(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
File_Id = TRUE; File_Id = TRUE;
} else { } else {
snprintf(temp1, PATH_MAX -1, "%s/%s file_id.diz", TIC.Inbound, TIC.TicIn.File); snprintf(temp1, PATH_MAX, "%s/%s file_id.diz", TIC.Inbound, TIC.TicIn.File);
if (execute_str(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) { if (execute_str(cmd, temp1, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
File_Id = TRUE; File_Id = TRUE;
} }
@ -584,7 +584,7 @@ int ProcessTic(fa_list **sbl)
/* /*
* Get new filesize for import and announce * Get new filesize for import and announce
*/ */
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.NewFile); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.NewFile);
TIC.FileSize = file_size(temp1); TIC.FileSize = file_size(temp1);
T_File.Size = TIC.FileSize; T_File.Size = TIC.FileSize;
T_File.SizeKb = TIC.FileSize / 1024; T_File.SizeKb = TIC.FileSize / 1024;
@ -607,8 +607,8 @@ int ProcessTic(fa_list **sbl)
if ((cmd == NULL) || (!strlen(cmd))) { if ((cmd == NULL) || (!strlen(cmd))) {
Syslog('!', "No banner command for %s", archiver.name); Syslog('!', "No banner command for %s", archiver.name);
} else { } else {
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.NewFile); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.NewFile);
snprintf(Temp, PATH_MAX -1, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner); snprintf(Temp, PATH_MAX, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner);
if (execute_str(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) { if (execute_str(cmd, temp1, (char *)NULL, Temp, (char *)"/dev/null", (char *)"/dev/null")) {
WriteError("Changing the banner failed"); WriteError("Changing the banner failed");
} else { } else {
@ -629,7 +629,7 @@ int ProcessTic(fa_list **sbl)
* If the file is converted, we set the date of the original * If the file is converted, we set the date of the original
* received file as the file creation date. * received file as the file creation date.
*/ */
snprintf(Temp, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.NewFile); snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.NewFile);
if ((MustRearc || DidBanner) && CFG.ct_KeepDate) { if ((MustRearc || DidBanner) && CFG.ct_KeepDate) {
if ((tic.Touch) && (tic.FileArea)) { if ((tic.Touch) && (tic.FileArea)) {
ut.actime = mktime(localtime(&TIC.FileDate)); ut.actime = mktime(localtime(&TIC.FileDate));
@ -687,7 +687,7 @@ int ProcessTic(fa_list **sbl)
* file in the inbound anymore so it can be * file in the inbound anymore so it can be
* deleted. * deleted.
*/ */
snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
if (file_rm(temp1) == 0) if (file_rm(temp1) == 0)
Syslog('f', "Deleted %s", temp1); Syslog('f', "Deleted %s", temp1);
} }
@ -703,7 +703,7 @@ int ProcessTic(fa_list **sbl)
if (CFG.akavalid[i] && (tic.Aka.zone == CFG.aka[i].zone)) { if (CFG.akavalid[i] && (tic.Aka.zone == CFG.aka[i].zone)) {
p_from = fido2faddr(CFG.aka[i]); p_from = fido2faddr(CFG.aka[i]);
if (! in_list(p_from, sbl, TRUE)) { if (! in_list(p_from, sbl, TRUE)) {
snprintf(sbe, 23, "%u:%u/%u", CFG.aka[i].zone, CFG.aka[i].net, CFG.aka[i].node); snprintf(sbe, 24, "%u:%u/%u", CFG.aka[i].zone, CFG.aka[i].net, CFG.aka[i].node);
fill_list(sbl, sbe, NULL); fill_list(sbl, sbe, NULL);
} }
tidy_faddr(p_from); tidy_faddr(p_from);
@ -715,7 +715,7 @@ int ProcessTic(fa_list **sbl)
*/ */
for (tmpq = qal; tmpq; tmpq = tmpq->next) { for (tmpq = qal; tmpq; tmpq = tmpq->next) {
if (tmpq->send) { if (tmpq->send) {
snprintf(sbe, 23, "%u:%u/%u", tmpq->aka.zone, tmpq->aka.net, tmpq->aka.node); snprintf(sbe, 24, "%u:%u/%u", tmpq->aka.zone, tmpq->aka.net, tmpq->aka.node);
fill_list(sbl, sbe, NULL); fill_list(sbl, sbe, NULL);
} }
} }
@ -739,7 +739,7 @@ int ProcessTic(fa_list **sbl)
Magic_AdoptFile(); Magic_AdoptFile();
snprintf(Temp, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicName); snprintf(Temp, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicName);
unlink(Temp); unlink(Temp);
free(Temp); free(Temp);

View File

@ -79,7 +79,7 @@ void flush_dir(char *ndir)
fd_list *fdl = NULL; fd_list *fdl = NULL;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/%s", CFG.out_queue, ndir); snprintf(temp, PATH_MAX, "%s/%s", CFG.out_queue, ndir);
if (chdir(temp) == -1) { if (chdir(temp) == -1) {
WriteError("$Error chdir to %s", temp); WriteError("$Error chdir to %s", temp);
free(temp); free(temp);
@ -103,7 +103,7 @@ void flush_dir(char *ndir)
nodenr.net = noden.net; nodenr.net = noden.net;
nodenr.node = noden.node; nodenr.node = noden.node;
nodenr.point = noden.point; nodenr.point = noden.point;
snprintf(nodenr.domain, 12, "%s", noden.domain); snprintf(nodenr.domain, 13, "%s", noden.domain);
if (!SearchNode(nodenr)) { if (!SearchNode(nodenr)) {
/* /*
@ -185,27 +185,27 @@ void flush_dir(char *ndir)
/* /*
* Generate ARCfile name from the CRC of the ASCII string of the node address. * Generate ARCfile name from the CRC of the ASCII string of the node address.
*/ */
snprintf(arcfile, PATH_MAX -1, "%s/%08lx.%s0", nodes.Dir_out_path, StringCRC32(ascfnode(&noden, 0x1f)), ext); snprintf(arcfile, PATH_MAX, "%s/%08lx.%s0", nodes.Dir_out_path, StringCRC32(ascfnode(&noden, 0x1f)), ext);
} else { } else {
bestaka = bestaka_s(&noden); bestaka = bestaka_s(&noden);
if (noden.point) { if (noden.point) {
snprintf(arcfile, PATH_MAX -1, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, snprintf(arcfile, PATH_MAX, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff,
((bestaka->node) - (noden.node) + (noden.point)) & 0xffff, ext); ((bestaka->node) - (noden.node) + (noden.point)) & 0xffff, ext);
} else if (bestaka->point) { } else if (bestaka->point) {
/* /*
* Inserted the next code for if we are a point, * Inserted the next code for if we are a point,
* I hope this is ARCmail 0.60 compliant. 21-May-1999 * I hope this is ARCmail 0.60 compliant. 21-May-1999
*/ */
snprintf(arcfile, PATH_MAX -1, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, snprintf(arcfile, PATH_MAX, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff,
((bestaka->node) - (noden.node) - (bestaka->point)) & 0xffff, ext); ((bestaka->node) - (noden.node) - (bestaka->point)) & 0xffff, ext);
} else { } else {
snprintf(arcfile, PATH_MAX -1, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, snprintf(arcfile, PATH_MAX, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff,
((bestaka->node) - (noden.node)) &0xffff, ext); ((bestaka->node) - (noden.node)) &0xffff, ext);
} }
} }
} else { } else {
snprintf(arcfile, PATH_MAX -1, "%s", arcname(&noden, nodes.Aka[0].zone, nodes.ARCmailCompat)); snprintf(arcfile, PATH_MAX, "%s", arcname(&noden, nodes.Aka[0].zone, nodes.ARCmailCompat));
} }
Syslog('P', "Arcmail file %s", arcfile); Syslog('P', "Arcmail file %s", arcfile);
@ -214,9 +214,9 @@ void flush_dir(char *ndir)
*/ */
pktfile = calloc(PATH_MAX, sizeof(char)); pktfile = calloc(PATH_MAX, sizeof(char));
fname = calloc(PATH_MAX, sizeof(char)); fname = calloc(PATH_MAX, sizeof(char));
snprintf(fname, PATH_MAX -1, "%s/mailpkt.qqq", temp); snprintf(fname, PATH_MAX, "%s/mailpkt.qqq", temp);
if (access(fname, W_OK) == 0) { if (access(fname, W_OK) == 0) {
snprintf(pktfile, PATH_MAX -1, "%s/%08lx.pkt", temp, sequencer()); snprintf(pktfile, PATH_MAX, "%s/%08lx.pkt", temp, sequencer());
if (rename(fname, pktfile)) { if (rename(fname, pktfile)) {
WriteError("$Can't rename %s to %s", fname, pktfile); WriteError("$Can't rename %s to %s", fname, pktfile);
} else { } else {
@ -452,7 +452,7 @@ void flush_dir(char *ndir)
flushed = TRUE; flushed = TRUE;
} }
snprintf(pktfile, PATH_MAX -1, "%s/%s", temp, fname); snprintf(pktfile, PATH_MAX, "%s/%s", temp, fname);
if (strstr(fname, ".ddd")) if (strstr(fname, ".ddd"))
flavor = 'd'; flavor = 'd';
@ -464,9 +464,9 @@ void flush_dir(char *ndir)
flavor = 'o'; flavor = 'o';
if (nodes.Session_out == S_DIR) { if (nodes.Session_out == S_DIR) {
snprintf(arcfile, PATH_MAX -1, "%s/%08lx.pkt", nodes.Dir_out_path, sequencer()); snprintf(arcfile, PATH_MAX, "%s/%08lx.pkt", nodes.Dir_out_path, sequencer());
} else { } else {
snprintf(arcfile, PATH_MAX -1, "%s", pktname(&noden, flavor)); snprintf(arcfile, PATH_MAX, "%s", pktname(&noden, flavor));
} }
Syslog('P', "Outfile: %s", arcfile); Syslog('P', "Outfile: %s", arcfile);
Syslog('P', "Pktfile: %s", pktfile); Syslog('P', "Pktfile: %s", pktfile);
@ -521,7 +521,7 @@ void flush_dir(char *ndir)
* file, this tells the location of the file and what to do with * file, this tells the location of the file and what to do with
* it after it is sent. * it after it is sent.
*/ */
snprintf(pktfile, PATH_MAX -1, "%s/.filelist", temp); snprintf(pktfile, PATH_MAX, "%s/.filelist", temp);
if ((fp = fopen(pktfile, "r")) != NULL) { if ((fp = fopen(pktfile, "r")) != NULL) {
Syslog('+', "Adding files for %s via %s", aka2str(nodenr), ascfnode(&noden, 0x1f)); Syslog('+', "Adding files for %s via %s", aka2str(nodenr), ascfnode(&noden, 0x1f));
@ -559,7 +559,7 @@ void flush_dir(char *ndir)
if (nodes.Session_out == S_DIRECT) { if (nodes.Session_out == S_DIRECT) {
attach(noden, p, mode, flavor); attach(noden, p, mode, flavor);
} else if (nodes.Session_out == S_DIR) { } else if (nodes.Session_out == S_DIR) {
snprintf(arcfile, PATH_MAX -1, "%s/%s", nodes.Dir_out_path, Basename(p)); snprintf(arcfile, PATH_MAX, "%s/%s", nodes.Dir_out_path, Basename(p));
if (mode == LEAVE) { if (mode == LEAVE) {
/* /*
* LEAVE file, so we copy this one. * LEAVE file, so we copy this one.
@ -626,7 +626,7 @@ void flush_queue(void)
} }
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/foobar", CFG.out_queue); snprintf(temp, PATH_MAX, "%s/foobar", CFG.out_queue);
mkdirs(temp, 0750); mkdirs(temp, 0750);
if ((dp = opendir(CFG.out_queue)) == 0) { if ((dp = opendir(CFG.out_queue)) == 0) {
@ -641,7 +641,7 @@ void flush_queue(void)
*/ */
while ((de = readdir(dp))) { while ((de = readdir(dp))) {
if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) { if (strcmp(de->d_name, ".") && strcmp(de->d_name, "..")) {
snprintf(temp, PATH_MAX -1, "%s/%s", CFG.out_queue, de->d_name); snprintf(temp, PATH_MAX, "%s/%s", CFG.out_queue, de->d_name);
Syslog('p', "Queue directory %s", temp); Syslog('p', "Queue directory %s", temp);
flush_dir(de->d_name); flush_dir(de->d_name);
if (chdir(CFG.out_queue)) if (chdir(CFG.out_queue))

View File

@ -161,7 +161,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if (newsmode) { if (newsmode) {
news_in++; news_in++;
snprintf(currentgroup, 80, "%s", msgs.Newsgroup); snprintf(currentgroup, 81, "%s", msgs.Newsgroup);
} else } else
email_in++; email_in++;
@ -634,12 +634,12 @@ int rfc2ftn(FILE *fp, faddr *recipient)
for (i = 0; i < 40; i++) { for (i = 0; i < 40; i++) {
if (CFG.akavalid[i] && (CFG.aka[i].point == 0) && (msgs.Aka.zone == CFG.aka[i].zone) && if (CFG.akavalid[i] && (CFG.aka[i].point == 0) && (msgs.Aka.zone == CFG.aka[i].zone) &&
!((msgs.Aka.net == CFG.aka[i].net) && (msgs.Aka.node == CFG.aka[i].node))) { !((msgs.Aka.net == CFG.aka[i].net) && (msgs.Aka.node == CFG.aka[i].node))) {
snprintf(sbe, 127, "%u/%u", CFG.aka[i].net, CFG.aka[i].node); snprintf(sbe, 128, "%u/%u", CFG.aka[i].net, CFG.aka[i].node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
} }
if (msgs.Aka.point == 0) { if (msgs.Aka.point == 0) {
snprintf(sbe, 127, "%u/%u", msgs.Aka.net, msgs.Aka.node); snprintf(sbe, 128, "%u/%u", msgs.Aka.net, msgs.Aka.node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
@ -655,15 +655,15 @@ int rfc2ftn(FILE *fp, faddr *recipient)
oldnet = sbl->addr->net-1; oldnet = sbl->addr->net-1;
for (tmpl = sbl; tmpl; tmpl = tmpl->next) { for (tmpl = sbl; tmpl; tmpl = tmpl->next) {
if (tmpl->addr->net == oldnet) if (tmpl->addr->net == oldnet)
snprintf(sbe,127," %u",tmpl->addr->node); snprintf(sbe,128," %u",tmpl->addr->node);
else else
snprintf(sbe,127," %u/%u",tmpl->addr->net, tmpl->addr->node); snprintf(sbe,128," %u/%u",tmpl->addr->net, tmpl->addr->node);
oldnet = tmpl->addr->net; oldnet = tmpl->addr->net;
seenlen += strlen(sbe); seenlen += strlen(sbe);
if (seenlen > MAXSEEN) { if (seenlen > MAXSEEN) {
seenlen = 0; seenlen = 0;
fprintf(ofp,"\nSEEN-BY:"); fprintf(ofp,"\nSEEN-BY:");
snprintf(sbe,127," %u/%u",tmpl->addr->net, tmpl->addr->node); snprintf(sbe,128," %u/%u",tmpl->addr->net, tmpl->addr->node);
seenlen = strlen(sbe); seenlen = strlen(sbe);
} }
fprintf(ofp,"%s",sbe); fprintf(ofp,"%s",sbe);
@ -678,7 +678,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
if (!strcasecmp(tmp->key,"X-FTN-PATH")) if (!strcasecmp(tmp->key,"X-FTN-PATH"))
fill_path(&ptl,tmp->val); fill_path(&ptl,tmp->val);
if (msgs.Aka.point == 0) { if (msgs.Aka.point == 0) {
snprintf(sbe,127,"%u/%u",msgs.Aka.net, msgs.Aka.node); snprintf(sbe,128,"%u/%u",msgs.Aka.net, msgs.Aka.node);
fill_path(&ptl,sbe); fill_path(&ptl,sbe);
} }
@ -692,15 +692,15 @@ int rfc2ftn(FILE *fp, faddr *recipient)
oldnet = ptl->addr->net-1; oldnet = ptl->addr->net-1;
for (tmpl = ptl; tmpl; tmpl = tmpl->next) { for (tmpl = ptl; tmpl; tmpl = tmpl->next) {
if (tmpl->addr->net == oldnet) if (tmpl->addr->net == oldnet)
snprintf(sbe,127," %u",tmpl->addr->node); snprintf(sbe,128," %u",tmpl->addr->node);
else else
snprintf(sbe,127," %u/%u",tmpl->addr->net, tmpl->addr->node); snprintf(sbe,128," %u/%u",tmpl->addr->net, tmpl->addr->node);
oldnet = tmpl->addr->net; oldnet = tmpl->addr->net;
seenlen += strlen(sbe); seenlen += strlen(sbe);
if (seenlen > MAXPATH) { if (seenlen > MAXPATH) {
seenlen = 0; seenlen = 0;
fprintf(ofp,"\n\1PATH:"); fprintf(ofp,"\n\1PATH:");
snprintf(sbe,127," %u/%u",tmpl->addr->net, tmpl->addr->node); snprintf(sbe,128," %u/%u",tmpl->addr->net, tmpl->addr->node);
seenlen = strlen(sbe); seenlen = strlen(sbe);
} }
fprintf(ofp,"%s",sbe); fprintf(ofp,"%s",sbe);

View File

@ -73,7 +73,7 @@ FILE *OpenData(char *Name)
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/%s", getenv("MBSE_ROOT"), Name); snprintf(temp, PATH_MAX, "%s/etc/%s", getenv("MBSE_ROOT"), Name);
if ((fp = fopen(temp, "r+")) == NULL) { if ((fp = fopen(temp, "r+")) == NULL) {
WriteError("$Can't open %s", temp); WriteError("$Can't open %s", temp);
free(temp); free(temp);
@ -364,7 +364,7 @@ void Rollover()
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char)); temp1 = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/var/mailer.hist", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/var/mailer.hist", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r"))) { if ((fp = fopen(temp, "r"))) {
fread(&history, sizeof(history), 1, fp); fread(&history, sizeof(history), 1, fp);
Temp = history.online; Temp = history.online;
@ -386,7 +386,7 @@ void Rollover()
t->tm_sec = 0; t->tm_sec = 0;
Now = mktime(t); Now = mktime(t);
Syslog('+', "Packing mailer history since %s", rfcdate(Now)); Syslog('+', "Packing mailer history since %s", rfcdate(Now));
snprintf(temp1, PATH_MAX -1, "%s/var/mailer.temp", getenv("MBSE_ROOT")); snprintf(temp1, PATH_MAX, "%s/var/mailer.temp", getenv("MBSE_ROOT"));
if ((ft = fopen(temp1, "a")) == NULL) { if ((ft = fopen(temp1, "a")) == NULL) {
WriteError("$Can't create %s", temp1); WriteError("$Can't create %s", temp1);
fclose(fp); fclose(fp);

View File

@ -87,7 +87,7 @@ void ScanMail(int DoAll)
Fname = calloc(PATH_MAX, sizeof(char)); Fname = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(Fname, PATH_MAX -1, "%s/tmp/echomail.jam", getenv("MBSE_ROOT")); snprintf(Fname, PATH_MAX, "%s/tmp/echomail.jam", getenv("MBSE_ROOT"));
if ((fp = fopen(Fname, "r")) != NULL) { if ((fp = fopen(Fname, "r")) != NULL) {
while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) { while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) {
path = strtok(temp, " \n\0"); path = strtok(temp, " \n\0");
@ -106,7 +106,7 @@ void ScanMail(int DoAll)
unlink(Fname); unlink(Fname);
} }
snprintf(Fname, PATH_MAX -1, "%s/tmp/netmail.jam", getenv("MBSE_ROOT")); snprintf(Fname, PATH_MAX, "%s/tmp/netmail.jam", getenv("MBSE_ROOT"));
if ((fp = fopen(Fname, "r")) != NULL) { if ((fp = fopen(Fname, "r")) != NULL) {
while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) { while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) {
path = strtok(temp, " \n\0"); path = strtok(temp, " \n\0");
@ -164,7 +164,7 @@ void ScanFull()
} }
sAreas = calloc(PATH_MAX, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
snprintf(sAreas, PATH_MAX -1, "%s/etc/users.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen(sAreas, "r")) != NULL) { if ((pAreas = fopen(sAreas, "r")) != NULL) {
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pAreas); fread(&usrconfighdr, sizeof(usrconfighdr), 1, pAreas);
@ -179,7 +179,7 @@ void ScanFull()
fflush(stdout); fflush(stdout);
} }
snprintf(sAreas, PATH_MAX -1, "%s/%s/mailbox", CFG.bbs_usersdir, usrconfig.Name); snprintf(sAreas, PATH_MAX, "%s/%s/mailbox", CFG.bbs_usersdir, usrconfig.Name);
if (Msg_Open(sAreas)) { if (Msg_Open(sAreas)) {
if ((Total = Msg_Number()) != 0L) { if ((Total = Msg_Number()) != 0L) {
Number = Msg_Lowest(); Number = Msg_Lowest();
@ -218,7 +218,7 @@ void ScanFull()
fclose(pAreas); fclose(pAreas);
} }
snprintf(sAreas, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen(sAreas, "r")) == NULL) { if ((pAreas = fopen(sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);
free(sAreas); free(sAreas);
@ -271,7 +271,7 @@ void ScanFull()
if (CFG.akavalid[i] && (msgs.Aka.zone == CFG.aka[i].zone) && if (CFG.akavalid[i] && (msgs.Aka.zone == CFG.aka[i].zone) &&
(CFG.aka[i].point == 0) && !((msgs.Aka.net == CFG.aka[i].net) && (CFG.aka[i].point == 0) && !((msgs.Aka.net == CFG.aka[i].net) &&
(msgs.Aka.node == CFG.aka[i].node))) { (msgs.Aka.node == CFG.aka[i].node))) {
snprintf(sbe, 127, "%u/%u", CFG.aka[i].net, CFG.aka[i].node); snprintf(sbe, 128, "%u/%u", CFG.aka[i].net, CFG.aka[i].node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
} }
@ -378,7 +378,7 @@ void ScanOne(char *path, unsigned long MsgNum)
} }
sAreas = calloc(PATH_MAX, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
snprintf(sAreas, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if ((pAreas = fopen(sAreas, "r")) == NULL) { if ((pAreas = fopen(sAreas, "r")) == NULL) {
WriteError("Can't open %s", sAreas); WriteError("Can't open %s", sAreas);
free(sAreas); free(sAreas);
@ -426,7 +426,7 @@ void ScanOne(char *path, unsigned long MsgNum)
for (i = 0; i < 40; i++) { for (i = 0; i < 40; i++) {
if (CFG.akavalid[i] && (msgs.Aka.zone == CFG.aka[i].zone) && (CFG.aka[i].point == 0) && if (CFG.akavalid[i] && (msgs.Aka.zone == CFG.aka[i].zone) && (CFG.aka[i].point == 0) &&
!((msgs.Aka.net == CFG.aka[i].net) && (msgs.Aka.node == CFG.aka[i].node))) { !((msgs.Aka.net == CFG.aka[i].net) && (msgs.Aka.node == CFG.aka[i].node))) {
snprintf(sbe, 127, "%u/%u", CFG.aka[i].net, CFG.aka[i].node); snprintf(sbe, 128, "%u/%u", CFG.aka[i].net, CFG.aka[i].node);
fill_list(&sbl, sbe, NULL); fill_list(&sbl, sbe, NULL);
} }
} }
@ -600,13 +600,13 @@ void ExportEcho(sysconnect L, unsigned long MsgNum, fa_list **sbl)
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (nodes.PackNetmail) if (nodes.PackNetmail)
snprintf(ext, 3, (char *)"qqq"); snprintf(ext, 4, (char *)"qqq");
else if (nodes.Crash) else if (nodes.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else if (nodes.Hold) else if (nodes.Hold)
snprintf(ext, 3, (char *)"hhh"); snprintf(ext, 4, (char *)"hhh");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
if ((qp = OpenPkt(msgs.Aka, L.aka, (char *)ext)) == NULL) if ((qp = OpenPkt(msgs.Aka, L.aka, (char *)ext)) == NULL)
return; return;
@ -655,15 +655,15 @@ void ExportEcho(sysconnect L, unsigned long MsgNum, fa_list **sbl)
oldnet = (*sbl)->addr->net - 1; oldnet = (*sbl)->addr->net - 1;
for (tmpl = *sbl; tmpl; tmpl = tmpl->next) { for (tmpl = *sbl; tmpl; tmpl = tmpl->next) {
if (tmpl->addr->net == oldnet) if (tmpl->addr->net == oldnet)
snprintf(sbe, 127, " %u", tmpl->addr->node); snprintf(sbe, 128, " %u", tmpl->addr->node);
else else
snprintf(sbe, 127, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 128, " %u/%u", tmpl->addr->net, tmpl->addr->node);
oldnet = tmpl->addr->net; oldnet = tmpl->addr->net;
seenlen += strlen(sbe); seenlen += strlen(sbe);
if (seenlen > MAXSEEN) { if (seenlen > MAXSEEN) {
seenlen = 0; seenlen = 0;
fprintf(qp, "\rSEEN-BY:"); fprintf(qp, "\rSEEN-BY:");
snprintf(sbe, 127, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 128, " %u/%u", tmpl->addr->net, tmpl->addr->node);
seenlen = strlen(sbe); seenlen = strlen(sbe);
} }
fprintf(qp, "%s", sbe); fprintf(qp, "%s", sbe);
@ -755,15 +755,15 @@ void ExportNews(unsigned long MsgNum, fa_list **sbl)
oldnet = (*sbl)->addr->net - 1; oldnet = (*sbl)->addr->net - 1;
for (tmpl = *sbl; tmpl; tmpl = tmpl->next) { for (tmpl = *sbl; tmpl; tmpl = tmpl->next) {
if (tmpl->addr->net == oldnet) if (tmpl->addr->net == oldnet)
snprintf(sbe, 127, " %u", tmpl->addr->node); snprintf(sbe, 128, " %u", tmpl->addr->node);
else else
snprintf(sbe, 127, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 128, " %u/%u", tmpl->addr->net, tmpl->addr->node);
oldnet = tmpl->addr->net; oldnet = tmpl->addr->net;
seenlen += strlen(sbe); seenlen += strlen(sbe);
if (seenlen > MAXSEEN) { if (seenlen > MAXSEEN) {
seenlen = 0; seenlen = 0;
fprintf(qp, "\nSEEN-BY:"); fprintf(qp, "\nSEEN-BY:");
snprintf(sbe, 127, " %u/%u", tmpl->addr->net, tmpl->addr->node); snprintf(sbe, 128, " %u/%u", tmpl->addr->net, tmpl->addr->node);
seenlen = strlen(sbe); seenlen = strlen(sbe);
} }
fprintf(qp, "%s", sbe); fprintf(qp, "%s", sbe);
@ -837,7 +837,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
for (i = 0; i < strlen(fromname); i++) for (i = 0; i < strlen(fromname); i++)
if (fromname[i] == ' ') if (fromname[i] == ' ')
fromname[i] = '_'; fromname[i] = '_';
snprintf(MailFrom, 127, "%s@%s", fromname, ascinode(from, 0x2f)); snprintf(MailFrom, 128, "%s@%s", fromname, ascinode(from, 0x2f));
if (Msg_Read(MsgNum, 79)) { if (Msg_Read(MsgNum, 79)) {
if ((p = (char *)MsgText_First()) != NULL) { if ((p = (char *)MsgText_First()) != NULL) {
@ -851,7 +851,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
q = strtok(p, " "); q = strtok(p, " ");
q = strtok(NULL, " \n\r\t"); q = strtok(NULL, " \n\r\t");
} }
snprintf(MailTo, 127, "%s", q); snprintf(MailTo, 128, "%s", q);
Syslog('m', "Final MailTo \"%s\"", MailTo); Syslog('m', "Final MailTo \"%s\"", MailTo);
break; break;
@ -933,11 +933,11 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
if (Msg.Crash || Msg.Direct || Msg.FileAttach || Msg.Immediate) { if (Msg.Crash || Msg.Direct || Msg.FileAttach || Msg.Immediate) {
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (Msg.Immediate) if (Msg.Immediate)
snprintf(ext, 3, (char *)"ddd"); snprintf(ext, 4, (char *)"ddd");
else if (Msg.Crash) else if (Msg.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
/* /*
* If the destination is a point, check if it is our point * If the destination is a point, check if it is our point
@ -981,13 +981,13 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
*/ */
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (nodes.PackNetmail) if (nodes.PackNetmail)
snprintf(ext, 3, (char *)"qqq"); snprintf(ext, 4, (char *)"qqq");
else if (nodes.Crash) else if (nodes.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else if (nodes.Hold) else if (nodes.Hold)
snprintf(ext, 3, (char *)"hhh"); snprintf(ext, 4, (char *)"hhh");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
if ((qp = OpenPkt(msgs.Aka, Route, (char *)ext)) == NULL) { if ((qp = OpenPkt(msgs.Aka, Route, (char *)ext)) == NULL) {
net_bad++; net_bad++;
return; return;
@ -1064,7 +1064,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate)
ta = parsefnode(Msg.ToAddress); ta = parsefnode(Msg.ToAddress);
p = calloc(PATH_MAX, sizeof(char)); p = calloc(PATH_MAX, sizeof(char));
snprintf(p, PATH_MAX -1, "%s/%d.%d.%d.%d/.filelist", CFG.out_queue, ta->zone, ta->net, ta->node, ta->point); snprintf(p, PATH_MAX, "%s/%d.%d.%d.%d/.filelist", CFG.out_queue, ta->zone, ta->net, ta->node, ta->point);
mkdirs(p, 0750); mkdirs(p, 0750);
if ((fl = fopen(p, "a+")) == NULL) { if ((fl = fopen(p, "a+")) == NULL) {
@ -1160,26 +1160,26 @@ void ExportEmail(unsigned long MsgNum)
if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) { if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) {
q = strtok(p, "<"); q = strtok(p, "<");
q = strtok(NULL, ">"); q = strtok(NULL, ">");
snprintf(MailFrom, 127, "%s", q); snprintf(MailFrom, 128, "%s", q);
} else if (Msg.From[0] == ' ') { } else if (Msg.From[0] == ' ') {
q = strtok(p, " "); q = strtok(p, " ");
q = strtok(NULL, " \n\r\t"); q = strtok(NULL, " \n\r\t");
snprintf(MailFrom, 127, "%s", q); snprintf(MailFrom, 128, "%s", q);
} else { } else {
snprintf(MailFrom, 127, "%s", Msg.From); snprintf(MailFrom, 128, "%s", Msg.From);
} }
p = Msg.To; p = Msg.To;
if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) { if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) {
q = strtok(p, "<"); q = strtok(p, "<");
q = strtok(NULL, ">"); q = strtok(NULL, ">");
snprintf(MailTo, 127, "%s", q); snprintf(MailTo, 128, "%s", q);
} else if (Msg.To[0] == ' ') { } else if (Msg.To[0] == ' ') {
q = strtok(p, " "); q = strtok(p, " ");
q = strtok(NULL, " \n\r\t"); q = strtok(NULL, " \n\r\t");
snprintf(MailTo, 127, "%s", q); snprintf(MailTo, 128, "%s", q);
} else { } else {
snprintf(MailTo, 127, "%s", Msg.To); snprintf(MailTo, 128, "%s", Msg.To);
} }
retval = postemail(qp, MailFrom, MailTo); retval = postemail(qp, MailFrom, MailTo);

View File

@ -109,7 +109,7 @@ void fill_artlist(List **fdp, char *id, long nr, int dupe)
for (tmp = fdp; *tmp; tmp = &((*tmp)->next)); for (tmp = fdp; *tmp; tmp = &((*tmp)->next));
*tmp = (List *)malloc(sizeof(List)); *tmp = (List *)malloc(sizeof(List));
(*tmp)->next = NULL; (*tmp)->next = NULL;
snprintf((*tmp)->msgid, MAX_MSGID_LEN -1, "%s", id); snprintf((*tmp)->msgid, MAX_MSGID_LEN, "%s", id);
(*tmp)->nr = nr; (*tmp)->nr = nr;
(*tmp)->isdupe = dupe; (*tmp)->isdupe = dupe;
} }
@ -196,7 +196,7 @@ void ScanNews(void)
} }
sAreas = calloc(PATH_MAX, sizeof(char)); sAreas = calloc(PATH_MAX, sizeof(char));
snprintf(sAreas, PATH_MAX -1, "%s/etc/mareas.data", getenv("MBSE_ROOT")); snprintf(sAreas, PATH_MAX, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
if(( pAreas = fopen (sAreas, "r")) == NULL) { if(( pAreas = fopen (sAreas, "r")) == NULL) {
WriteError("$Can't open Messages Areas File."); WriteError("$Can't open Messages Areas File.");
return; return;
@ -259,7 +259,7 @@ int do_one_group(List **art, char *grpname, char *ftntag, int maxarticles)
Syslog('m', "do_one_group(%s, %s)", grpname, ftntag); Syslog('m', "do_one_group(%s, %s)", grpname, ftntag);
IsDoing((char *)"Scan %s", grpname); IsDoing((char *)"Scan %s", grpname);
snprintf(temp, 127, "GROUP %s\r\n", grpname); snprintf(temp, 128, "GROUP %s\r\n", grpname);
nntp_send(temp); nntp_send(temp);
resp = nntp_receive(); resp = nntp_receive();
retval = atoi(strtok(resp, " ")); retval = atoi(strtok(resp, " "));
@ -341,11 +341,11 @@ int get_article(char *msgid, char *ftntag)
return RETVAL_ERROR; return RETVAL_ERROR;
} }
snprintf(dpath, PATH_MAX -1, "%s/tmp/scannews.last", getenv("MBSE_ROOT")); snprintf(dpath, PATH_MAX, "%s/tmp/scannews.last", getenv("MBSE_ROOT"));
dp = fopen(dpath, "w"); dp = fopen(dpath, "w");
IsDoing("Article %d", (news_in + 1)); IsDoing("Article %d", (news_in + 1));
snprintf(cmd, 80, "ARTICLE %s\r\n", msgid); snprintf(cmd, 81, "ARTICLE %s\r\n", msgid);
fprintf(dp, "ARTICLE %s\n", msgid); fprintf(dp, "ARTICLE %s\n", msgid);
nntp_send(cmd); nntp_send(cmd);
resp = nntp_receive(); resp = nntp_receive();
@ -396,7 +396,7 @@ int get_xover(char *grpname, long startnr, long endnr, List **art)
unsigned long crc; unsigned long crc;
POverview pov; POverview pov;
snprintf(cmd, 80, "XOVER %ld-%ld\r\n", startnr, endnr); snprintf(cmd, 81, "XOVER %ld-%ld\r\n", startnr, endnr);
if ((retval = nntp_cmd(cmd, 224))) { if ((retval = nntp_cmd(cmd, 224))) {
switch (retval) { switch (retval) {
case 412: WriteError("No newsgroup selected"); case 412: WriteError("No newsgroup selected");

View File

@ -60,14 +60,14 @@ FILE *SendMgrMail(faddr *t, int Keep, int FileAttach, char *bymgr, char *subj, c
Orig.net = From.net; Orig.net = From.net;
Orig.node = From.node; Orig.node = From.node;
Orig.point = From.point; Orig.point = From.point;
snprintf(Orig.domain, 12, "%s", From.domain); snprintf(Orig.domain, 13, "%s", From.domain);
memset(&Dest, 0, sizeof(Dest)); memset(&Dest, 0, sizeof(Dest));
Dest.zone = t->zone; Dest.zone = t->zone;
Dest.net = t->net; Dest.net = t->net;
Dest.node = t->node; Dest.node = t->node;
Dest.point = t->point; Dest.point = t->point;
snprintf(Dest.domain, 12, "%s", t->domain); snprintf(Dest.domain, 13, "%s", t->domain);
if (!SearchNode(Dest)) { if (!SearchNode(Dest)) {
Syslog('!', "SendMgrMail(): Can't find node %s", aka2str(Dest)); Syslog('!', "SendMgrMail(): Can't find node %s", aka2str(Dest));
@ -90,13 +90,13 @@ FILE *SendMgrMail(faddr *t, int Keep, int FileAttach, char *bymgr, char *subj, c
memset(&ext, 0, sizeof(ext)); memset(&ext, 0, sizeof(ext));
if (nodes.PackNetmail) if (nodes.PackNetmail)
snprintf(ext, 3, (char *)"qqq"); snprintf(ext, 4, (char *)"qqq");
else if (nodes.Crash) else if (nodes.Crash)
snprintf(ext, 3, (char *)"ccc"); snprintf(ext, 4, (char *)"ccc");
else if (nodes.Hold) else if (nodes.Hold)
snprintf(ext, 3, (char *)"hhh"); snprintf(ext, 4, (char *)"hhh");
else else
snprintf(ext, 3, (char *)"nnn"); snprintf(ext, 4, (char *)"nnn");
if ((qp = OpenPkt(Orig, Dest, (char *)ext)) == NULL) if ((qp = OpenPkt(Orig, Dest, (char *)ext)) == NULL)
return NULL; return NULL;

View File

@ -247,7 +247,7 @@ int LoadTic(char *inb, char *tfn)
} else if (strncasecmp(Temp, "crc ", 4) == 0) { } else if (strncasecmp(Temp, "crc ", 4) == 0) {
TIC.Crc_Int = strtoul(Temp+4, (char **)NULL, 16); TIC.Crc_Int = strtoul(Temp+4, (char **)NULL, 16);
snprintf(TIC.TicIn.Crc, 8, "%08lX", TIC.Crc_Int); snprintf(TIC.TicIn.Crc, 9, "%08lX", TIC.Crc_Int);
strcpy(T_File.Crc, TIC.TicIn.Crc); strcpy(T_File.Crc, TIC.TicIn.Crc);
} else if (strncasecmp(Temp, "pw ", 3) == 0) { } else if (strncasecmp(Temp, "pw ", 3) == 0) {
@ -414,7 +414,7 @@ int LoadTic(char *inb, char *tfn)
tidy_falist(&sbl); tidy_falist(&sbl);
return 2; return 2;
} }
snprintf(Temp2, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.FullName); snprintf(Temp2, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.FullName);
if ((rc = file_mv(Temp, Temp2))) { if ((rc = file_mv(Temp, Temp2))) {
WriteError("Can't move %s to inbound: %s", Temp, strerror(rc)); WriteError("Can't move %s to inbound: %s", Temp, strerror(rc));
tidy_falist(&sbl); tidy_falist(&sbl);
@ -468,7 +468,7 @@ int LoadTic(char *inb, char *tfn)
* processing is based on 8.3 filenames. * processing is based on 8.3 filenames.
*/ */
snprintf(Temp, bufsize, "%s/%s", TIC.Inbound, RealName); snprintf(Temp, bufsize, "%s/%s", TIC.Inbound, RealName);
snprintf(Temp2, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); snprintf(Temp2, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File);
if (rename(Temp, Temp2)) if (rename(Temp, Temp2))
WriteError("$Can't rename %s to %s", Temp, Temp2); WriteError("$Can't rename %s to %s", Temp, Temp2);
else else

View File

@ -47,7 +47,7 @@ int Add_ToBeRep(struct _filerecord report)
int rc, Found = FALSE; int rc, Found = FALSE;
fname = calloc(PATH_MAX, sizeof(char)); fname = calloc(PATH_MAX, sizeof(char));
snprintf(fname, PATH_MAX -1, "%s/etc/toberep.data", getenv("MBSE_ROOT")); snprintf(fname, PATH_MAX, "%s/etc/toberep.data", getenv("MBSE_ROOT"));
if ((tbr = fopen(fname, "r+")) == NULL) { if ((tbr = fopen(fname, "r+")) == NULL) {
if ((tbr = fopen(fname, "a+")) == NULL) { if ((tbr = fopen(fname, "a+")) == NULL) {
WriteError("$Can't create %s", fname); WriteError("$Can't create %s", fname);

View File

@ -168,7 +168,7 @@ int GetTableRoute(char *ftn, fidoaddr *res)
* Check routing table * Check routing table
*/ */
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/route.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/route.data", getenv("MBSE_ROOT"));
if ((fil = fopen(temp, "r")) == NULL) { if ((fil = fopen(temp, "r")) == NULL) {
free(temp); free(temp);
return R_NOROUTE; return R_NOROUTE;
@ -327,7 +327,7 @@ int TrackMail(fidoaddr too, fidoaddr *routeto)
routeto->net = nodes.RouteVia.net; routeto->net = nodes.RouteVia.net;
routeto->node = nodes.RouteVia.node; routeto->node = nodes.RouteVia.node;
routeto->point = nodes.RouteVia.point; routeto->point = nodes.RouteVia.point;
snprintf(routeto->domain, 12, "%s", nodes.RouteVia.domain); snprintf(routeto->domain, 13, "%s", nodes.RouteVia.domain);
} else { } else {
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
if (routeto->zone == nodes.Aka[i].zone) if (routeto->zone == nodes.Aka[i].zone)
@ -336,7 +336,7 @@ int TrackMail(fidoaddr too, fidoaddr *routeto)
routeto->net = nodes.Aka[i].net; routeto->net = nodes.Aka[i].net;
routeto->node = nodes.Aka[i].node; routeto->node = nodes.Aka[i].node;
routeto->point = nodes.Aka[i].point; routeto->point = nodes.Aka[i].point;
snprintf(routeto->domain, 12, "%s", nodes.Aka[i].domain); snprintf(routeto->domain, 13, "%s", nodes.Aka[i].domain);
} }
Syslog('r', "Final routing to: %s", aka2str(*routeto)); Syslog('r', "Final routing to: %s", aka2str(*routeto));
return R_ROUTE; return R_ROUTE;
@ -473,7 +473,7 @@ int GetRoute(char *ftn, fidoaddr *res)
dir.net = dest->net; dir.net = dest->net;
dir.node = dest->node; dir.node = dest->node;
dir.point = dest->point; dir.point = dest->point;
snprintf(dir.domain, 12, "%s", dest->domain); snprintf(dir.domain, 13, "%s", dest->domain);
/* /*
* First direct match * First direct match
@ -557,7 +557,7 @@ int GetRoute(char *ftn, fidoaddr *res)
*/ */
if (me_host != -1) { if (me_host != -1) {
Syslog('r', "We are a host"); Syslog('r', "We are a host");
snprintf(res->domain, 12, "%s", CFG.aka[me_host].domain); snprintf(res->domain, 13, "%s", CFG.aka[me_host].domain);
if (((myregion != dnlent->region) && (!(dnlent->pflag & NL_DUMMY))) || (CFG.aka[me_host].zone != dest->zone)) { if (((myregion != dnlent->region) && (!(dnlent->pflag & NL_DUMMY))) || (CFG.aka[me_host].zone != dest->zone)) {
res->zone = CFG.aka[me_host].zone; res->zone = CFG.aka[me_host].zone;
res->net = myregion; res->net = myregion;
@ -611,7 +611,7 @@ int GetRoute(char *ftn, fidoaddr *res)
*/ */
if (me_hub != -1) { if (me_hub != -1) {
Syslog('r', "We are a hub"); Syslog('r', "We are a hub");
snprintf(res->domain, 12, "%s", CFG.aka[me_hub].domain); snprintf(res->domain, 13, "%s", CFG.aka[me_hub].domain);
if ((dnlent->upnode == CFG.aka[me_hub].node) && (dnlent->upnet == CFG.aka[me_hub].net) && if ((dnlent->upnode == CFG.aka[me_hub].node) && (dnlent->upnet == CFG.aka[me_hub].net) &&
(dnlent->addr.zone == CFG.aka[me_hub].zone)) { (dnlent->addr.zone == CFG.aka[me_hub].zone)) {
res->zone = dest->zone; res->zone = dest->zone;
@ -648,7 +648,7 @@ int GetRoute(char *ftn, fidoaddr *res)
res->zone = bnlent->addr.zone; res->zone = bnlent->addr.zone;
res->net = bnlent->upnet; res->net = bnlent->upnet;
res->node = bnlent->upnode; res->node = bnlent->upnode;
snprintf(res->domain, 12, "%s", bnlent->addr.domain); snprintf(res->domain, 13, "%s", bnlent->addr.domain);
Syslog('+', "R: %s => %s", ascfnode(dest, 0xff), aka2str(*res)); Syslog('+', "R: %s => %s", ascfnode(dest, 0xff), aka2str(*res));
if (bnlent->addr.domain) if (bnlent->addr.domain)
free(bnlent->addr.domain); free(bnlent->addr.domain);

View File

@ -45,7 +45,7 @@ char *MakeTicName()
static char buf[13]; static char buf[13];
buf[12] = '\0'; buf[12] = '\0';
snprintf(buf, 12, "%08lx.tic", sequencer()); snprintf(buf, 13, "%08lx.tic", sequencer());
buf[0] = 'm'; buf[0] = 'm';
buf[1] = 'b'; buf[1] = 'b';
@ -112,7 +112,7 @@ int Rearc(char *unarc)
Syslog('f' , "NewFile=\"%s\", NewFullName=\"%s\"", TIC.NewFile, TIC.NewFullName); Syslog('f' , "NewFile=\"%s\", NewFullName=\"%s\"", TIC.NewFile, TIC.NewFullName);
snprintf(temp, PATH_MAX -1, "%s/%s .", TIC.Inbound, TIC.NewFile); snprintf(temp, PATH_MAX, "%s/%s .", TIC.Inbound, TIC.NewFile);
if (execute_str(cmd, temp, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) { if (execute_str(cmd, temp, (char *)NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null") == 0) {
free(cmd); free(cmd);
return TRUE; return TRUE;
@ -138,7 +138,7 @@ void DeleteVirusWork()
buf = calloc(PATH_MAX, sizeof(char)); buf = calloc(PATH_MAX, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
getcwd(buf, PATH_MAX); getcwd(buf, PATH_MAX);
snprintf(temp, PATH_MAX -1, "%s/tmp", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT"));
if (chdir(temp) == 0) { if (chdir(temp) == 0) {
Syslog('f', "DeleteVirusWork %s/arc", temp); Syslog('f', "DeleteVirusWork %s/arc", temp);
@ -160,7 +160,7 @@ void Bad(char *format, ...)
va_list va_ptr; va_list va_ptr;
va_start(va_ptr, format); va_start(va_ptr, format);
vsnprintf(outstr, 1023, format, va_ptr); vsnprintf(outstr, 1024, format, va_ptr);
va_end(va_ptr); va_end(va_ptr);
WriteError(outstr); WriteError(outstr);
@ -173,7 +173,7 @@ void Bad(char *format, ...)
void ReCalcCrc(char *fn) void ReCalcCrc(char *fn)
{ {
TIC.Crc_Int = file_crc(fn, CFG.slow_util && do_quiet); TIC.Crc_Int = file_crc(fn, CFG.slow_util && do_quiet);
snprintf(TIC.TicIn.Crc, 8, "%08lX", TIC.Crc_Int); snprintf(TIC.TicIn.Crc, 9, "%08lX", TIC.Crc_Int);
strcpy(T_File.Crc, TIC.TicIn.Crc); strcpy(T_File.Crc, TIC.TicIn.Crc);
} }
@ -187,9 +187,9 @@ int Get_File_Id()
int i, j, lines = 0; int i, j, lines = 0;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
snprintf(temp, PATH_MAX -1, "%s/tmp/file_id.diz", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/tmp/file_id.diz", getenv("MBSE_ROOT"));
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
free(temp); free(temp);
return FALSE; return FALSE;

View File

@ -48,9 +48,9 @@ int VirScan(char *path)
stdlog = calloc(PATH_MAX, sizeof(char)); stdlog = calloc(PATH_MAX, sizeof(char));
errlog = calloc(PATH_MAX, sizeof(char)); errlog = calloc(PATH_MAX, sizeof(char));
snprintf(temp, PATH_MAX -1, "%s/etc/virscan.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/virscan.data", getenv("MBSE_ROOT"));
snprintf(stdlog, PATH_MAX -1, "%s/tmp/stdlog%d", getenv("MBSE_ROOT"), mypid); snprintf(stdlog, PATH_MAX, "%s/tmp/stdlog%d", getenv("MBSE_ROOT"), mypid);
snprintf(errlog, PATH_MAX -1, "%s/tmp/errlog%d", getenv("MBSE_ROOT"), mypid); snprintf(errlog, PATH_MAX, "%s/tmp/errlog%d", getenv("MBSE_ROOT"), mypid);
if ((fp = fopen(temp, "r")) == NULL) { if ((fp = fopen(temp, "r")) == NULL) {
WriteError("No virus scanners defined"); WriteError("No virus scanners defined");