diff --git a/mbfido/makestat.c b/mbfido/makestat.c index 1b58ebc4..4b7010c7 100644 --- a/mbfido/makestat.c +++ b/mbfido/makestat.c @@ -49,7 +49,7 @@ FILE *newpage(char *Name, FILE *fi) later = time(NULL) + 86400; 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); if ((fa = fopen(temp, "w")) == NULL) { @@ -79,8 +79,8 @@ void closepage(FILE *fa, char *Name, FILE *fi) temp2 = calloc(PATH_MAX, sizeof(char)); MacroRead(fi, fa); fclose(fa); - snprintf(temp1, PATH_MAX -1, "%s/stat/%s.html", CFG.www_root, Name); - snprintf(temp2, PATH_MAX -1, "%s/stat/%s.temp", CFG.www_root, Name); + snprintf(temp1, PATH_MAX, "%s/stat/%s.html", CFG.www_root, Name); + snprintf(temp2, PATH_MAX, "%s/stat/%s.temp", CFG.www_root, Name); rename(temp2, temp1); chmod(temp1, 0644); free(temp2); @@ -97,10 +97,10 @@ char *adate(time_t now) struct tm ptm; if (now == 0L) { - snprintf(buf, 39, " "); + snprintf(buf, 40, " "); } else { 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; } @@ -133,7 +133,7 @@ void MakeStat(void) else 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) { WriteError("Can't open %s", name); } else { @@ -174,7 +174,7 @@ void MakeStat(void) printf("."); 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) { WriteError("$Can't open %s", name); } else { @@ -225,7 +225,7 @@ void MakeStat(void) printf("."); 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) { WriteError("$Can't open %s", name); } else { @@ -265,7 +265,7 @@ void MakeStat(void) printf("."); 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) { WriteError("$Can't open %s", name); } else { @@ -307,7 +307,7 @@ void MakeStat(void) printf("."); 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) { WriteError("$Can't open %s", name); } else { @@ -355,7 +355,7 @@ void MakeStat(void) printf("."); 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) { WriteError("$Can't open %s", name); } else { @@ -407,7 +407,7 @@ void MakeStat(void) printf("."); 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 ((fi = OpenMacro("html.sysinfo", 'E', TRUE)) == NULL) { Syslog('+', "Can't open macro file, skipping html pages creation"); diff --git a/mbfido/mbfkill.c b/mbfido/mbfkill.c index 407e15d9..5780021a 100644 --- a/mbfido/mbfkill.c +++ b/mbfido/mbfkill.c @@ -67,7 +67,7 @@ void Kill(void) 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) { WriteError("Can't open %s", sAreas); @@ -148,8 +148,8 @@ void Kill(void) if (area.MoveArea) { fseek(pAreas, ((area.MoveArea -1) * areahdr.recsize) + areahdr.hdrsize, SEEK_SET); fread(&darea, areahdr.recsize, 1, pAreas); - snprintf(from, PATH_MAX -1, "%s/%s", area.Path, fdb.Name); - snprintf(to, PATH_MAX -1, "%s/%s", darea.Path, fdb.Name); + snprintf(from, PATH_MAX, "%s/%s", area.Path, fdb.Name); + snprintf(to, PATH_MAX, "%s/%s", darea.Path, fdb.Name); if ((rc = file_mv(from, to)) == 0) { Syslog('+', "Move %s, area %d => %d", fdb.Name, i, area.MoveArea); 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. */ - snprintf(from, PATH_MAX -1, "%s/.%s", area.Path, fdb.Name); - snprintf(to, PATH_MAX -1, "%s/.%s", darea.Path, fdb.Name); + snprintf(from, PATH_MAX, "%s/.%s", area.Path, fdb.Name); + snprintf(to, PATH_MAX, "%s/.%s", darea.Path, fdb.Name); if (file_exist(from, R_OK) == 0) file_mv(from, to); /* * 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); /* * Create the new symbolic link */ - snprintf(from, PATH_MAX -1, "%s/%s", darea.Path, fdb.Name); - snprintf(to, PATH_MAX -1, "%s/%s", darea.Path, fdb.LName); + snprintf(from, PATH_MAX, "%s/%s", darea.Path, fdb.Name); + snprintf(to, PATH_MAX, "%s/%s", darea.Path, fdb.LName); symlink(from, to); fdb.Deleted = TRUE; @@ -199,11 +199,11 @@ void Kill(void) mbsedb_UnlockFDB(fdb_area); } iKilled++; - snprintf(from, PATH_MAX -1, "%s/%s", area.Path, fdb.LName); + snprintf(from, PATH_MAX, "%s/%s", area.Path, fdb.LName); 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); - snprintf(from, PATH_MAX -1, "%s/.%s", area.Path, fdb.Name); + snprintf(from, PATH_MAX, "%s/.%s", area.Path, fdb.Name); unlink(from); } } diff --git a/mbfido/mbflist.c b/mbfido/mbflist.c index 90a168d2..11fec611 100644 --- a/mbfido/mbflist.c +++ b/mbfido/mbflist.c @@ -69,7 +69,7 @@ void ListFileAreas(int Area) sTic = calloc(PATH_MAX, 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) { WriteError("Can't open %s", sAreas); printf("Can't open %s\n", sAreas); @@ -83,7 +83,7 @@ void ListFileAreas(int Area) if (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) { WriteError("Can't open %s", sTic); printf("Can't open %s\n", sTic); @@ -121,7 +121,7 @@ void ListFileAreas(int Area) mbse_colour(LIGHTGRAY, BLACK); while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) { - snprintf(flags, 3, "---"); + snprintf(flags, 4, "---"); if (fdb.Deleted) flags[0] = 'D'; if (fdb.NoKill) diff --git a/mbfido/mbfpack.c b/mbfido/mbfpack.c index d5e1df4c..f26cfeea 100644 --- a/mbfido/mbfpack.c +++ b/mbfido/mbfpack.c @@ -61,7 +61,7 @@ void PackFileBase(void) 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) { 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); } else { 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); if (rc && (errno != ENOENT)) 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); if (rc && (errno != ENOENT)) Syslog('+', "Unlink %s failed, result %d", fn, rc); /* * 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); } do_index = TRUE; diff --git a/mbfido/mbfrearc.c b/mbfido/mbfrearc.c index 768a1ee9..17d3b257 100644 --- a/mbfido/mbfrearc.c +++ b/mbfido/mbfrearc.c @@ -90,7 +90,7 @@ void ReArc(int Area, char *File) while (fread(&fdb, fdbhdr.recsize, 1, fdb_area->fp) == 1) { if (re_exec(fdb.LName) || re_exec(fdb.Name)) { 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++; rc = rearc(temp, area.Archiver, do_quiet); @@ -105,7 +105,7 @@ void ReArc(int Area, char *File) } 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); Syslog('+', "New name %s", temp); @@ -129,7 +129,7 @@ void ReArc(int Area, char *File) *p = '\0'; else if ((p = strstr(fdb.Name, "HA"))) *p = '\0'; - snprintf(p, 5, "%s", archiver.name); + snprintf(p, 6, "%s", archiver.name); if ((p = strstr(fdb.LName, "arc"))) *p = '\0'; else if ((p = strstr(fdb.LName, "lha"))) @@ -154,7 +154,7 @@ void ReArc(int Area, char *File) *p = '\0'; else if ((p = strstr(fdb.LName, "ha"))) *p = '\0'; - snprintf(p, 5, "%s", tl(archiver.name)); + snprintf(p, 6, "%s", tl(archiver.name)); Syslog('f', "%s %s", fdb.Name, fdb.LName); fdb.Size = file_size(temp); fdb.Crc32 = file_crc(temp, FALSE); @@ -172,7 +172,7 @@ void ReArc(int Area, char *File) if (strcmp(fdb.Name, mname)) { Syslog('+', "Converted 8.3 name to %s", 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); strcpy(temp, mname); } @@ -186,7 +186,7 @@ void ReArc(int Area, char *File) /* * 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); free(linkpath); if (strlen(fdb.Magic)) diff --git a/mbfido/mbfsort.c b/mbfido/mbfsort.c index bfb6042e..bea6f855 100644 --- a/mbfido/mbfsort.c +++ b/mbfido/mbfsort.c @@ -59,7 +59,7 @@ void SortFileBase(int Area) 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) { WriteError("Can't open %s", sAreas); diff --git a/mbfido/mbftoberep.c b/mbfido/mbftoberep.c index e00b368f..b0fcc6fb 100644 --- a/mbfido/mbftoberep.c +++ b/mbfido/mbftoberep.c @@ -57,7 +57,7 @@ void ToBeRep(void) mbse_colour(CYAN, BLACK); 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) { printf("No toberep database present\n"); } else { diff --git a/mbfido/mbfutil.c b/mbfido/mbfutil.c index 6b5b2ab9..68512700 100644 --- a/mbfido/mbfutil.c +++ b/mbfido/mbfutil.c @@ -209,7 +209,7 @@ void DeleteVirusWork() buf = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char)); 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) { 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. */ - 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 (mkdir(temp, 0777)) { WriteError("$Can't create %s", temp); @@ -256,10 +256,10 @@ int UnpackFile(char *File) /* * 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)) 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)) Syslog('+', "Removed stale %s", temp); @@ -278,7 +278,7 @@ int UnpackFile(char *File) 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) { WriteError("$Can't change to %s", temp); die(MBERR_GENERAL); @@ -367,7 +367,7 @@ int CheckFDB(int Area, char *Path) int rc = FALSE; 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. @@ -397,7 +397,7 @@ int CheckFDB(int Area, char *Path) * Now check the download directory */ 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)) Syslog('+', "Created directory %s", Path); } @@ -419,7 +419,7 @@ int LoadAreaRec(int Area) 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) { WriteError("$Can't open %s", sAreas); if (!do_quiet) diff --git a/mbfido/mbindex.c b/mbfido/mbindex.c index 1251f1a6..b9195843 100644 --- a/mbfido/mbindex.c +++ b/mbfido/mbindex.c @@ -254,7 +254,7 @@ char *fullpath(char *fname) { 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; } @@ -686,7 +686,7 @@ void fill_fdlist(fd_list **fdp, char *filename, time_t filedate) tmp = (fd_list *)malloc(sizeof(fd_list)); tmp->next = *fdp; - snprintf(tmp->fname, 64, "%s", filename); + snprintf(tmp->fname, 65, "%s", filename); tmp->fdate = filedate; *fdp = tmp; } @@ -757,7 +757,7 @@ char *pull_fdlist(fd_list **fdp) ta = *fdp; memset(&buf, 0, sizeof(buf)); - snprintf(buf, 64, "%s", ta->fname); + snprintf(buf, 65, "%s", ta->fname); if (ta->next != NULL) *fdp = ta->next; @@ -825,8 +825,8 @@ int makelist(char *base, unsigned short zo, unsigned short ne, unsigned short no tidy_fdlist(&fdl); memset(&fdx, 0, sizeof(fdx)); - snprintf(fdx.filename, 12, "%s", p); - snprintf(fdx.domain, 12, "%s", fidonet.domain); + snprintf(fdx.filename, 13, "%s", p); + snprintf(fdx.domain, 13, "%s", fidonet.domain); fdx.number = filenr; fwrite(&fdx, sizeof(fdx), 1, ffp); diff --git a/mbfido/mbmsg.c b/mbfido/mbmsg.c index c491667a..b6dcc9e5 100644 --- a/mbfido/mbmsg.c +++ b/mbfido/mbmsg.c @@ -264,7 +264,7 @@ void DoMsgBase() 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) { WriteError("$Can't open %s", sAreas); die(MBERR_GENERAL); @@ -331,7 +331,7 @@ void DoMsgBase() fclose(pAreas); 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) { WriteError("$Can't open %s", sAreas); die(MBERR_GENERAL); @@ -341,13 +341,13 @@ void DoMsgBase() while (fread(&usrconfig, usrconfighdr.recsize, 1, pAreas) == 1) { if (usrconfig.Email && strlen(usrconfig.Name)) { 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) { mbse_colour(CYAN, BLACK); printf("\r .. %-40s", Name); 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++; processed = FALSE; if (do_kill) @@ -360,7 +360,7 @@ void DoMsgBase() LinkArea(sAreas, 0); if (processed) 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); are_tot++; processed = FALSE; @@ -373,7 +373,7 @@ void DoMsgBase() LinkArea(sAreas, 0); if (processed) 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); are_tot++; processed = FALSE; diff --git a/mbfido/mgrutil.c b/mbfido/mgrutil.c index ba2389ad..cb699d56 100644 --- a/mbfido/mgrutil.c +++ b/mbfido/mgrutil.c @@ -106,7 +106,7 @@ void WriteMailGroups(FILE *fp, faddr *f) fgetpos(fi,&fileptr); 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) { WriteError("$Can't open %s", temp); @@ -165,7 +165,7 @@ void WriteFileGroups(FILE *fp, faddr *f) fgetpos(fi,&fileptr); 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) { 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.node = From->node; Orig.point = From->point; - snprintf(Orig.domain, 12, "%s", From->domain); + snprintf(Orig.domain, 13, "%s", From->domain); memset(&Dest, 0, sizeof(Dest)); Dest.zone = t->zone; Dest.net = t->net; Dest.node = t->node; Dest.point = t->point; - snprintf(Dest.domain, 12, "%s", t->domain); + snprintf(Dest.domain, 13, "%s", t->domain); if (!SearchNode(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)); if (nodes.PackNetmail) - snprintf(ext, 3, (char *)"qqq"); + snprintf(ext, 4, (char *)"qqq"); else if (nodes.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else if (nodes.Hold) - snprintf(ext, 3, (char *)"hhh"); + snprintf(ext, 4, (char *)"hhh"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); if ((qp = OpenPkt(Orig, Dest, (char *)ext)) == NULL) return 4; @@ -542,7 +542,7 @@ int Areas(void) temp = calloc(PATH_MAX, 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) { WriteError("Can't open %s", temp); } else { @@ -557,7 +557,7 @@ int Areas(void) fflush(stdout); } 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) { WriteError("Can't open %s", temp); } 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"); 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) { WriteError("Can't open %s", temp); tidy_arealist(&alist); @@ -652,7 +652,7 @@ int Areas(void) * the area is set to read-only and all links are disconnected. * 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) { WriteError("Can't open %s for r/w"); } else { @@ -666,12 +666,12 @@ int Areas(void) while (fread(&msgs, msgshdr.recsize, 1, fp) == 1) { if (msgs.Active && !strcmp(msgs.Group, mgroup.Name) && !strcmp(msgs.Tag, tmp->Name)) { 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)) { Mgrlog("Marking echo %s, group %s, area %d read-only", msgs.Tag, mgroup.Name, ((ftell(fp) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize)) + 1); msgs.MsgKinds = RONLY; // Area read-only - snprintf(msgs.Group, 12, "DELETED"); // Make groupname invalid + snprintf(msgs.Group, 13, "DELETED"); // Make groupname invalid } else { Mgrlog("Removing empty echo %s, group %s, area %d", msgs.Tag, mgroup.Name, ((ftell(fp) - msgshdr.hdrsize) / (msgshdr.recsize + msgshdr.syssize)) + 1); @@ -740,7 +740,7 @@ int Areas(void) 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) { WriteError("Can't open %s", temp); } else { @@ -755,7 +755,7 @@ int Areas(void) fflush(stdout); } 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) { WriteError("Can't open %s", temp); } 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"); 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) { WriteError("Can't open %s", temp); tidy_arealist(&alist); @@ -896,7 +896,7 @@ int Areas(void) * still warned about that by the "mbfile check" command. */ 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) { WriteError("Can't open %s for r/w"); } else { diff --git a/mbfido/mover.c b/mbfido/mover.c index 0c6725ca..b9eabb62 100644 --- a/mbfido/mover.c +++ b/mbfido/mover.c @@ -43,8 +43,8 @@ void mover(char *fn) From = calloc(PATH_MAX, sizeof(char)); To = calloc(PATH_MAX, sizeof(char)); - snprintf(From, PATH_MAX -1, "%s/%s", TIC.Inbound, fn); - snprintf(To, PATH_MAX -1, "%s/%s", CFG.badtic, fn); + snprintf(From, PATH_MAX, "%s/%s", TIC.Inbound, fn); + snprintf(To, PATH_MAX, "%s/%s", CFG.badtic, fn); Syslog('!', "Moving %s to %s", From, To); if (mkdirs(To, 0770)) { diff --git a/mbfido/msg.c b/mbfido/msg.c index e54363b4..e1d8ce08 100644 --- a/mbfido/msg.c +++ b/mbfido/msg.c @@ -114,7 +114,7 @@ int toss_onemsg(char *msgname) net_msgs++; 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) { WriteError("$Can't open %s", temp); @@ -315,7 +315,7 @@ int toss_onemsg(char *msgname) (strncasecmp(toUserName, "postmaster", 10) == 0) || (strncasecmp(toUserName, "coordinator", 11) == 0)) { 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); } net_imp++; @@ -328,19 +328,19 @@ int toss_onemsg(char *msgname) Msg.Netmail = TRUE; 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 - 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 (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 - 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 { 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 - 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) { 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) { fprintf(np, "%s %lu\n", msgs.Base, Msg.Id); fclose(np); @@ -385,7 +385,7 @@ int toss_onemsg(char *msgname) if (rc == 0) { 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) WriteError("Can't remove %s", temp); } diff --git a/mbfido/msgutil.c b/mbfido/msgutil.c index 258d14c7..46963f16 100644 --- a/mbfido/msgutil.c +++ b/mbfido/msgutil.c @@ -72,7 +72,7 @@ void Msg_Id(fidoaddr aka) unsigned long crc = -1; 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); Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp)); Msg.ReplyCRC = 0xffffffff; @@ -87,16 +87,16 @@ void Msg_Pid(void) time_t tt; 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); if (msgs.Charset != FTNC_NONE) { - snprintf(temp, 80, "\001CHRS: %s", getftnchrs(msgs.Charset)); + snprintf(temp, 81, "\001CHRS: %s", getftnchrs(msgs.Charset)); } else { - snprintf(temp, 80, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1)); + snprintf(temp, 81, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1)); } MsgText_Add2(temp); tt = time(NULL); - snprintf(temp, 80, "\001TZUTC: %s", gmtoffset(tt)); + snprintf(temp, 81, "\001TZUTC: %s", gmtoffset(tt)); MsgText_Add2(temp); free(temp); } @@ -168,7 +168,7 @@ long Msg_Top(char *template, int language, fidoaddr aka) 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) { fread(&ttyinfohdr, sizeof(ttyinfohdr), 1, fp); while (fread(&ttyinfo, ttyinfohdr.recsize, 1, fp) == 1) { @@ -220,11 +220,11 @@ void Msg_Bot(fidoaddr UseAka, char *Org, char *template) MsgText_Add2(TearLine()); 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 - 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); free(aka); free(temp); @@ -238,7 +238,7 @@ void CountPosted(char *Base) FILE *fp; 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) { fread(&msgshdr, sizeof(msgshdr), 1, fp); diff --git a/mbfido/newspost.c b/mbfido/newspost.c index ced8260e..8c2d22f3 100644 --- a/mbfido/newspost.c +++ b/mbfido/newspost.c @@ -60,7 +60,7 @@ int newspost(void) * a file, try to post the articles. They may be * 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 (newsopen) WriteError("$Can't reopen %s", buf); @@ -115,7 +115,7 @@ int newspost(void) */ if ((CFG.newsfeed == FEEDUUCP) || (CFG.newsfeed == FEEDRNEWS)) { 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) { WriteError("$Can't create %s", buf); free(buf); @@ -178,7 +178,7 @@ int newspost(void) } else Syslog('+', "Articles send through %s", CFG.rnewspath); fclose(ofp); - snprintf(buf, 10239, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); + snprintf(buf, 10240, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); unlink(buf); } @@ -194,7 +194,7 @@ int newspost(void) 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) { WriteError("Can't create %s", buf); 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", utsbuf.nodename, seqnr, utsbuf.nodename, seqnr, utsbuf.nodename, seqnr); 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) { WriteError("Can't create %s", buf); newsopen = FALSE; @@ -215,12 +215,12 @@ int newspost(void) } Syslog('+', "Articles placed in %s", CFG.rnewspath); fclose(ofp); - snprintf(buf, 10239, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); + snprintf(buf, 10240, "%s/tmp/newsbatch", getenv("MBSE_ROOT")); unlink(buf); } if (! news_bad) { - snprintf(buf, 10239, "%s/tmp/newsout", getenv("MBSE_ROOT")); + snprintf(buf, 10240, "%s/tmp/newsout", getenv("MBSE_ROOT")); unlink(buf); } diff --git a/mbfido/notify.c b/mbfido/notify.c index 00fa8ff0..4c452274 100644 --- a/mbfido/notify.c +++ b/mbfido/notify.c @@ -68,7 +68,7 @@ int Notify(char *Options) } if (strlen(Options)) { - snprintf(Opt, 43, "%s~", Options); + snprintf(Opt, 44, "%s~", Options); if (strchr(Opt, '.') != NULL) { temp = strdup(strtok(Opt, ":")); if (atoi(temp)) @@ -112,7 +112,7 @@ int Notify(char *Options) Syslog('m', "Parsing nodes %d:%d/%d.%d", Zones, Nets, Nodes, Points); 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) { WriteError("$Can't open %s", temp); return FALSE; diff --git a/mbfido/post.c b/mbfido/post.c index 6404d255..f2b44028 100644 --- a/mbfido/post.c +++ b/mbfido/post.c @@ -69,7 +69,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor) } 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) { WriteError("$Can't open %s", sAreas); free(sAreas); @@ -163,8 +163,8 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor) /* * Start writing the message */ - snprintf(Msg.From, 100, CFG.sysop_name); - snprintf(Msg.To, 100, To); + snprintf(Msg.From, 101, CFG.sysop_name); + snprintf(Msg.To, 101, To); /* * 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.FromAddress, 100, "%s", aka2str(msgs.Aka)); + snprintf(Msg.Subject, 101, "%s", Subj); + snprintf(Msg.FromAddress, 101, "%s", aka2str(msgs.Aka)); Msg.Written = time(NULL); Msg.Arrived = time(NULL); Msg.Local = TRUE; @@ -200,7 +200,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor) case NETMAIL: Msg.Netmail = TRUE; - snprintf(Msg.ToAddress, 100, "%s", ascfnode(parsefaddr(To), 0xff)); + snprintf(Msg.ToAddress, 101, "%s", ascfnode(parsefaddr(To), 0xff)); break; case ECHOMAIL: @@ -213,22 +213,22 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor) } 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); Msg.MsgIdCRC = upd_crc32(temp, crc, strlen(temp)); 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); 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 { - snprintf(temp, PATH_MAX -1, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1)); + snprintf(temp, PATH_MAX, "\001CHRS: %s", getftnchrs(FTNC_LATIN_1)); } MsgText_Add2(temp); - snprintf(temp, PATH_MAX -1, "\001TZUTC: %s", gmtoffset(tt)); + snprintf(temp, PATH_MAX, "\001TZUTC: %s", gmtoffset(tt)); MsgText_Add2(temp); - while ((Fgets(temp, PATH_MAX -1, tp)) != NULL) { + while ((Fgets(temp, PATH_MAX, tp)) != NULL) { if (strncmp(temp, "--- ", 4) == 0) has_tear = TRUE; 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)); 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 - 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)) - snprintf(temp, 80, " * Origin: %s %s", msgs.Origin, aka); + snprintf(temp, 81, " * Origin: %s %s", msgs.Origin, aka); else - snprintf(temp, 80, " * Origin: %s %s", CFG.origin, aka); + snprintf(temp, 81, " * Origin: %s %s", CFG.origin, aka); MsgText_Add2(temp); free(aka); @@ -273,7 +273,7 @@ int Post(char *To, long Area, char *Subj, char *File, char *Flavor) Syslog('+', "Posted message %ld", Msg.Id); 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) { fprintf(fp, "%s %lu\n", msgs.Base, Msg.Id); fclose(fp); diff --git a/mbfido/postecho.c b/mbfido/postecho.c index e58d3f7d..c14e7b14 100644 --- a/mbfido/postecho.c +++ b/mbfido/postecho.c @@ -79,13 +79,13 @@ int EchoOut(fidoaddr aka, char *toname, char *fromname, char *subj, FILE *fp, in */ memset(&ext, 0, sizeof(ext)); if (nodes.PackNetmail) - snprintf(ext, 3, (char *)"qqq"); + snprintf(ext, 4, (char *)"qqq"); else if (nodes.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else if (nodes.Hold) - snprintf(ext, 3, (char *)"hhh"); + snprintf(ext, 4, (char *)"hhh"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); if ((qp = OpenPkt(msgs.Aka, aka, (char *)ext)) == NULL) { 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"); 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); 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++) { 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))) { - 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); } } @@ -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. */ - 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); 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) { 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); } } @@ -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; for (tmpl = sbl; tmpl; tmpl = tmpl->next) { if (tmpl->addr->net == oldnet) - snprintf(sbe, 15, " %u", tmpl->addr->node); + snprintf(sbe, 16, " %u", tmpl->addr->node); 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; seenlen += strlen(sbe); if (seenlen > MAXSEEN) { seenlen = 0; 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); } 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; for (tmpl = ptl; tmpl; tmpl = tmpl->next) { if (tmpl->addr->net == oldnet) - snprintf(sbe, 15, " %u", tmpl->addr->node); + snprintf(sbe, 16, " %u", tmpl->addr->node); 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; seenlen += strlen(sbe); if (seenlen > MAXPATH) { seenlen = 0; 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); } fprintf(nfp, "%s", sbe); diff --git a/mbfido/postnetmail.c b/mbfido/postnetmail.c index dd99372e..13e0a522 100644 --- a/mbfido/postnetmail.c +++ b/mbfido/postnetmail.c @@ -247,7 +247,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t na.node = t->node; na.point = t->point; if (SearchFidonet(na.zone)) - snprintf(na.domain, 12, "%s", fidonet.domain); + snprintf(na.domain, 13, "%s", fidonet.domain); switch(TrackMail(na, &routeto)) { case R_LOCAL: @@ -288,7 +288,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t */ (void)noderecord(f); 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) { WriteError("$Can't open %s", p); } else { @@ -374,13 +374,13 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t memset(&ext, 0, sizeof(ext)); if (nodes.PackNetmail) - snprintf(ext, 3, (char *)"qqq"); + snprintf(ext, 4, (char *)"qqq"); else if (nodes.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else if (nodes.Hold) - snprintf(ext, 3, (char *)"hhh"); + snprintf(ext, 4, (char *)"hhh"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); if ((net = OpenPkt(Orig , routeto, (char *)ext)) == NULL) { net_bad++; diff --git a/mbfido/ptic.c b/mbfido/ptic.c index 46be5a46..d62df7bf 100644 --- a/mbfido/ptic.c +++ b/mbfido/ptic.c @@ -101,7 +101,7 @@ int ProcessTic(fa_list **sbl) /* * 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); Age = (Now - Fdate) / 84400; Syslog('+', "Orphaned tic age %d days", Age); @@ -115,7 +115,7 @@ int ProcessTic(fa_list **sbl) 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); TIC.FileSize = file_size(Temp); TIC.FileDate = file_time(Temp); @@ -210,7 +210,7 @@ int ProcessTic(fa_list **sbl) } 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); Syslog('+', "Deleted file %s", temp1); file_rm(Temp); @@ -238,7 +238,7 @@ int ProcessTic(fa_list **sbl) strcpy(TIC.BBSpath, CFG.ticout); strcpy(TIC.BBSdesc, tic.Comment); } 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) { WriteError("Can't access fareas.data area: %ld", tic.FileArea); free(Temp); @@ -282,7 +282,7 @@ int ProcessTic(fa_list **sbl) } 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 = upd_crc32(Temp, crc2, strlen(Temp)); if (CheckDupe(crc2, D_FILEECHO, CFG.tic_dupes)) { @@ -364,8 +364,8 @@ int ProcessTic(fa_list **sbl) * it's a passthru area. */ if (((tic.SendOrg) && (MustRearc || strlen(tic.Banner))) || (!tic.FileArea)) { - snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); - snprintf(temp2, PATH_MAX -1, "%s/%s", CFG.ticout, TIC.TicIn.File); + snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File); + snprintf(temp2, PATH_MAX, "%s/%s", CFG.ticout, TIC.TicIn.File); if ((rc = file_cp(temp1, temp2) == 0)) { TIC.SendOrg = TRUE; } else { @@ -378,7 +378,7 @@ int ProcessTic(fa_list **sbl) /* * 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 (mkdir(temp2, 0777)) { WriteError("$Can't create %s", temp2); @@ -391,16 +391,16 @@ int ProcessTic(fa_list **sbl) /* * 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)) 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)) 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)) 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)) Syslog('+', "Removed stale %s", temp1); @@ -431,7 +431,7 @@ int ProcessTic(fa_list **sbl) if ((cmd == NULL) || (cmd == "")) { Syslog('!', "No unarc command available"); } 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) { UnPacked = TRUE; } else { @@ -451,8 +451,8 @@ int ProcessTic(fa_list **sbl) * whatever that is. This should catch single files * with worms or other macro viri */ - snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); - snprintf(temp2, PATH_MAX -1, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File); + snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.TicIn.File); + snprintf(temp2, PATH_MAX, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File); if ((rc = file_cp(temp1, temp2))) { WriteError("Can't copy %s to %s: %s", temp1, temp2, strerror(rc)); @@ -461,7 +461,7 @@ int ProcessTic(fa_list **sbl) 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) { WriteError("$Can't change to %s", temp2); free(Temp); @@ -495,12 +495,12 @@ int ProcessTic(fa_list **sbl) if (tic.FileId && tic.FileArea && IsArchive) { if (UnPacked) { - snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); - snprintf(temp2, PATH_MAX -1, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); + snprintf(temp2, PATH_MAX, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); if (file_cp(temp1, temp2) == 0) { File_Id = TRUE; } 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) { File_Id = TRUE; } @@ -514,13 +514,13 @@ int ProcessTic(fa_list **sbl) if (cmd == NULL) { WriteError("No unarc command available"); } else { - snprintf(temp1, PATH_MAX -1, "%s/tmp", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX, "%s/tmp", getenv("MBSE_ROOT")); 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) { File_Id = TRUE; } 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) { File_Id = TRUE; } @@ -584,7 +584,7 @@ int ProcessTic(fa_list **sbl) /* * 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); T_File.Size = TIC.FileSize; T_File.SizeKb = TIC.FileSize / 1024; @@ -607,8 +607,8 @@ int ProcessTic(fa_list **sbl) if ((cmd == NULL) || (!strlen(cmd))) { Syslog('!', "No banner command for %s", archiver.name); } else { - snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.NewFile); - snprintf(Temp, PATH_MAX -1, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner); + snprintf(temp1, PATH_MAX, "%s/%s", TIC.Inbound, TIC.NewFile); + 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")) { WriteError("Changing the banner failed"); } else { @@ -629,7 +629,7 @@ int ProcessTic(fa_list **sbl) * If the file is converted, we set the date of the original * 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 ((tic.Touch) && (tic.FileArea)) { ut.actime = mktime(localtime(&TIC.FileDate)); @@ -687,7 +687,7 @@ int ProcessTic(fa_list **sbl) * file in the inbound anymore so it can be * 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) 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)) { p_from = fido2faddr(CFG.aka[i]); 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); } tidy_faddr(p_from); @@ -715,7 +715,7 @@ int ProcessTic(fa_list **sbl) */ for (tmpq = qal; tmpq; tmpq = tmpq->next) { 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); } } @@ -739,7 +739,7 @@ int ProcessTic(fa_list **sbl) 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); free(Temp); diff --git a/mbfido/queue.c b/mbfido/queue.c index 0baa71b7..51f543dd 100644 --- a/mbfido/queue.c +++ b/mbfido/queue.c @@ -79,7 +79,7 @@ void flush_dir(char *ndir) fd_list *fdl = NULL; 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) { WriteError("$Error chdir to %s", temp); free(temp); @@ -103,7 +103,7 @@ void flush_dir(char *ndir) nodenr.net = noden.net; nodenr.node = noden.node; nodenr.point = noden.point; - snprintf(nodenr.domain, 12, "%s", noden.domain); + snprintf(nodenr.domain, 13, "%s", noden.domain); 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. */ - 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 { bestaka = bestaka_s(&noden); 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); } else if (bestaka->point) { /* * Inserted the next code for if we are a point, * 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); } 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); } } } 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); @@ -214,9 +214,9 @@ void flush_dir(char *ndir) */ pktfile = 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) { - snprintf(pktfile, PATH_MAX -1, "%s/%08lx.pkt", temp, sequencer()); + snprintf(pktfile, PATH_MAX, "%s/%08lx.pkt", temp, sequencer()); if (rename(fname, pktfile)) { WriteError("$Can't rename %s to %s", fname, pktfile); } else { @@ -452,7 +452,7 @@ void flush_dir(char *ndir) flushed = TRUE; } - snprintf(pktfile, PATH_MAX -1, "%s/%s", temp, fname); + snprintf(pktfile, PATH_MAX, "%s/%s", temp, fname); if (strstr(fname, ".ddd")) flavor = 'd'; @@ -464,9 +464,9 @@ void flush_dir(char *ndir) flavor = 'o'; 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 { - snprintf(arcfile, PATH_MAX -1, "%s", pktname(&noden, flavor)); + snprintf(arcfile, PATH_MAX, "%s", pktname(&noden, flavor)); } Syslog('P', "Outfile: %s", arcfile); 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 * 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) { 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) { attach(noden, p, mode, flavor); } 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) { /* * LEAVE file, so we copy this one. @@ -626,7 +626,7 @@ void flush_queue(void) } 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); if ((dp = opendir(CFG.out_queue)) == 0) { @@ -641,7 +641,7 @@ void flush_queue(void) */ while ((de = readdir(dp))) { 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); flush_dir(de->d_name); if (chdir(CFG.out_queue)) diff --git a/mbfido/rfc2ftn.c b/mbfido/rfc2ftn.c index 30c4462d..80f57cb0 100644 --- a/mbfido/rfc2ftn.c +++ b/mbfido/rfc2ftn.c @@ -161,7 +161,7 @@ int rfc2ftn(FILE *fp, faddr *recipient) if (newsmode) { news_in++; - snprintf(currentgroup, 80, "%s", msgs.Newsgroup); + snprintf(currentgroup, 81, "%s", msgs.Newsgroup); } else email_in++; @@ -634,12 +634,12 @@ int rfc2ftn(FILE *fp, faddr *recipient) for (i = 0; i < 40; i++) { 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))) { - 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); } } 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); } @@ -655,15 +655,15 @@ int rfc2ftn(FILE *fp, faddr *recipient) oldnet = sbl->addr->net-1; for (tmpl = sbl; tmpl; tmpl = tmpl->next) { if (tmpl->addr->net == oldnet) - snprintf(sbe,127," %u",tmpl->addr->node); + snprintf(sbe,128," %u",tmpl->addr->node); 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; seenlen += strlen(sbe); if (seenlen > MAXSEEN) { seenlen = 0; 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); } fprintf(ofp,"%s",sbe); @@ -678,7 +678,7 @@ int rfc2ftn(FILE *fp, faddr *recipient) if (!strcasecmp(tmp->key,"X-FTN-PATH")) fill_path(&ptl,tmp->val); 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); } @@ -692,15 +692,15 @@ int rfc2ftn(FILE *fp, faddr *recipient) oldnet = ptl->addr->net-1; for (tmpl = ptl; tmpl; tmpl = tmpl->next) { if (tmpl->addr->net == oldnet) - snprintf(sbe,127," %u",tmpl->addr->node); + snprintf(sbe,128," %u",tmpl->addr->node); 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; seenlen += strlen(sbe); if (seenlen > MAXPATH) { seenlen = 0; 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); } fprintf(ofp,"%s",sbe); diff --git a/mbfido/rollover.c b/mbfido/rollover.c index 514926a3..0b8159ec 100644 --- a/mbfido/rollover.c +++ b/mbfido/rollover.c @@ -73,7 +73,7 @@ FILE *OpenData(char *Name) 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) { WriteError("$Can't open %s", temp); free(temp); @@ -364,7 +364,7 @@ void Rollover() temp = 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"))) { fread(&history, sizeof(history), 1, fp); Temp = history.online; @@ -386,7 +386,7 @@ void Rollover() t->tm_sec = 0; Now = mktime(t); 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) { WriteError("$Can't create %s", temp1); fclose(fp); diff --git a/mbfido/scan.c b/mbfido/scan.c index 79b9d624..39e98b39 100644 --- a/mbfido/scan.c +++ b/mbfido/scan.c @@ -87,7 +87,7 @@ void ScanMail(int DoAll) Fname = 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) { while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) { path = strtok(temp, " \n\0"); @@ -106,7 +106,7 @@ void ScanMail(int DoAll) 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) { while ((fgets(temp, PATH_MAX - 1, fp)) != NULL) { path = strtok(temp, " \n\0"); @@ -164,7 +164,7 @@ void ScanFull() } 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) { fread(&usrconfighdr, sizeof(usrconfighdr), 1, pAreas); @@ -179,7 +179,7 @@ void ScanFull() 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 ((Total = Msg_Number()) != 0L) { Number = Msg_Lowest(); @@ -218,7 +218,7 @@ void ScanFull() 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) { WriteError("Can't open %s", sAreas); free(sAreas); @@ -271,7 +271,7 @@ void ScanFull() 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))) { - 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); } } @@ -378,7 +378,7 @@ void ScanOne(char *path, unsigned long MsgNum) } 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) { WriteError("Can't open %s", sAreas); free(sAreas); @@ -426,7 +426,7 @@ void ScanOne(char *path, unsigned long MsgNum) for (i = 0; i < 40; i++) { 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))) { - 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); } } @@ -600,13 +600,13 @@ void ExportEcho(sysconnect L, unsigned long MsgNum, fa_list **sbl) memset(&ext, 0, sizeof(ext)); if (nodes.PackNetmail) - snprintf(ext, 3, (char *)"qqq"); + snprintf(ext, 4, (char *)"qqq"); else if (nodes.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else if (nodes.Hold) - snprintf(ext, 3, (char *)"hhh"); + snprintf(ext, 4, (char *)"hhh"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); if ((qp = OpenPkt(msgs.Aka, L.aka, (char *)ext)) == NULL) return; @@ -655,15 +655,15 @@ void ExportEcho(sysconnect L, unsigned long MsgNum, fa_list **sbl) oldnet = (*sbl)->addr->net - 1; for (tmpl = *sbl; tmpl; tmpl = tmpl->next) { if (tmpl->addr->net == oldnet) - snprintf(sbe, 127, " %u", tmpl->addr->node); + snprintf(sbe, 128, " %u", tmpl->addr->node); 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; seenlen += strlen(sbe); if (seenlen > MAXSEEN) { seenlen = 0; 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); } fprintf(qp, "%s", sbe); @@ -755,15 +755,15 @@ void ExportNews(unsigned long MsgNum, fa_list **sbl) oldnet = (*sbl)->addr->net - 1; for (tmpl = *sbl; tmpl; tmpl = tmpl->next) { if (tmpl->addr->net == oldnet) - snprintf(sbe, 127, " %u", tmpl->addr->node); + snprintf(sbe, 128, " %u", tmpl->addr->node); 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; seenlen += strlen(sbe); if (seenlen > MAXSEEN) { seenlen = 0; 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); } fprintf(qp, "%s", sbe); @@ -837,7 +837,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate) for (i = 0; i < strlen(fromname); i++) if (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 ((p = (char *)MsgText_First()) != NULL) { @@ -851,7 +851,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate) q = strtok(p, " "); q = strtok(NULL, " \n\r\t"); } - snprintf(MailTo, 127, "%s", q); + snprintf(MailTo, 128, "%s", q); Syslog('m', "Final MailTo \"%s\"", MailTo); break; @@ -933,11 +933,11 @@ void ExportNet(unsigned long MsgNum, int UUCPgate) if (Msg.Crash || Msg.Direct || Msg.FileAttach || Msg.Immediate) { memset(&ext, 0, sizeof(ext)); if (Msg.Immediate) - snprintf(ext, 3, (char *)"ddd"); + snprintf(ext, 4, (char *)"ddd"); else if (Msg.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); /* * 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)); if (nodes.PackNetmail) - snprintf(ext, 3, (char *)"qqq"); + snprintf(ext, 4, (char *)"qqq"); else if (nodes.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else if (nodes.Hold) - snprintf(ext, 3, (char *)"hhh"); + snprintf(ext, 4, (char *)"hhh"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); if ((qp = OpenPkt(msgs.Aka, Route, (char *)ext)) == NULL) { net_bad++; return; @@ -1064,7 +1064,7 @@ void ExportNet(unsigned long MsgNum, int UUCPgate) ta = parsefnode(Msg.ToAddress); 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); if ((fl = fopen(p, "a+")) == NULL) { @@ -1160,26 +1160,26 @@ void ExportEmail(unsigned long MsgNum) if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) { q = strtok(p, "<"); q = strtok(NULL, ">"); - snprintf(MailFrom, 127, "%s", q); + snprintf(MailFrom, 128, "%s", q); } else if (Msg.From[0] == ' ') { q = strtok(p, " "); q = strtok(NULL, " \n\r\t"); - snprintf(MailFrom, 127, "%s", q); + snprintf(MailFrom, 128, "%s", q); } else { - snprintf(MailFrom, 127, "%s", Msg.From); + snprintf(MailFrom, 128, "%s", Msg.From); } p = Msg.To; if ((strchr(p, '<') != NULL) && (strchr(p, '>') != NULL)) { q = strtok(p, "<"); q = strtok(NULL, ">"); - snprintf(MailTo, 127, "%s", q); + snprintf(MailTo, 128, "%s", q); } else if (Msg.To[0] == ' ') { q = strtok(p, " "); q = strtok(NULL, " \n\r\t"); - snprintf(MailTo, 127, "%s", q); + snprintf(MailTo, 128, "%s", q); } else { - snprintf(MailTo, 127, "%s", Msg.To); + snprintf(MailTo, 128, "%s", Msg.To); } retval = postemail(qp, MailFrom, MailTo); diff --git a/mbfido/scannews.c b/mbfido/scannews.c index f3ffdc7f..9f755449 100644 --- a/mbfido/scannews.c +++ b/mbfido/scannews.c @@ -109,7 +109,7 @@ void fill_artlist(List **fdp, char *id, long nr, int dupe) for (tmp = fdp; *tmp; tmp = &((*tmp)->next)); *tmp = (List *)malloc(sizeof(List)); (*tmp)->next = NULL; - snprintf((*tmp)->msgid, MAX_MSGID_LEN -1, "%s", id); + snprintf((*tmp)->msgid, MAX_MSGID_LEN, "%s", id); (*tmp)->nr = nr; (*tmp)->isdupe = dupe; } @@ -196,7 +196,7 @@ void ScanNews(void) } 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) { WriteError("$Can't open Messages Areas File."); 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); IsDoing((char *)"Scan %s", grpname); - snprintf(temp, 127, "GROUP %s\r\n", grpname); + snprintf(temp, 128, "GROUP %s\r\n", grpname); nntp_send(temp); resp = nntp_receive(); retval = atoi(strtok(resp, " ")); @@ -341,11 +341,11 @@ int get_article(char *msgid, char *ftntag) 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"); 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); nntp_send(cmd); resp = nntp_receive(); @@ -396,7 +396,7 @@ int get_xover(char *grpname, long startnr, long endnr, List **art) unsigned long crc; 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))) { switch (retval) { case 412: WriteError("No newsgroup selected"); diff --git a/mbfido/sendmail.c b/mbfido/sendmail.c index 0e4f7d70..463b59f3 100644 --- a/mbfido/sendmail.c +++ b/mbfido/sendmail.c @@ -60,14 +60,14 @@ FILE *SendMgrMail(faddr *t, int Keep, int FileAttach, char *bymgr, char *subj, c Orig.net = From.net; Orig.node = From.node; Orig.point = From.point; - snprintf(Orig.domain, 12, "%s", From.domain); + snprintf(Orig.domain, 13, "%s", From.domain); memset(&Dest, 0, sizeof(Dest)); Dest.zone = t->zone; Dest.net = t->net; Dest.node = t->node; Dest.point = t->point; - snprintf(Dest.domain, 12, "%s", t->domain); + snprintf(Dest.domain, 13, "%s", t->domain); if (!SearchNode(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)); if (nodes.PackNetmail) - snprintf(ext, 3, (char *)"qqq"); + snprintf(ext, 4, (char *)"qqq"); else if (nodes.Crash) - snprintf(ext, 3, (char *)"ccc"); + snprintf(ext, 4, (char *)"ccc"); else if (nodes.Hold) - snprintf(ext, 3, (char *)"hhh"); + snprintf(ext, 4, (char *)"hhh"); else - snprintf(ext, 3, (char *)"nnn"); + snprintf(ext, 4, (char *)"nnn"); if ((qp = OpenPkt(Orig, Dest, (char *)ext)) == NULL) return NULL; diff --git a/mbfido/tic.c b/mbfido/tic.c index f2e0af9f..8d5edfa6 100644 --- a/mbfido/tic.c +++ b/mbfido/tic.c @@ -247,7 +247,7 @@ int LoadTic(char *inb, char *tfn) } else if (strncasecmp(Temp, "crc ", 4) == 0) { 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); } else if (strncasecmp(Temp, "pw ", 3) == 0) { @@ -414,7 +414,7 @@ int LoadTic(char *inb, char *tfn) tidy_falist(&sbl); 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))) { WriteError("Can't move %s to inbound: %s", Temp, strerror(rc)); tidy_falist(&sbl); @@ -468,7 +468,7 @@ int LoadTic(char *inb, char *tfn) * processing is based on 8.3 filenames. */ 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)) WriteError("$Can't rename %s to %s", Temp, Temp2); else diff --git a/mbfido/toberep.c b/mbfido/toberep.c index 55b735fd..d99636f0 100644 --- a/mbfido/toberep.c +++ b/mbfido/toberep.c @@ -47,7 +47,7 @@ int Add_ToBeRep(struct _filerecord report) int rc, Found = FALSE; 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, "a+")) == NULL) { WriteError("$Can't create %s", fname); diff --git a/mbfido/tracker.c b/mbfido/tracker.c index 29054414..949424c0 100644 --- a/mbfido/tracker.c +++ b/mbfido/tracker.c @@ -168,7 +168,7 @@ int GetTableRoute(char *ftn, fidoaddr *res) * Check routing table */ 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) { free(temp); return R_NOROUTE; @@ -327,7 +327,7 @@ int TrackMail(fidoaddr too, fidoaddr *routeto) routeto->net = nodes.RouteVia.net; routeto->node = nodes.RouteVia.node; routeto->point = nodes.RouteVia.point; - snprintf(routeto->domain, 12, "%s", nodes.RouteVia.domain); + snprintf(routeto->domain, 13, "%s", nodes.RouteVia.domain); } else { for (i = 0; i < 20; i++) if (routeto->zone == nodes.Aka[i].zone) @@ -336,7 +336,7 @@ int TrackMail(fidoaddr too, fidoaddr *routeto) routeto->net = nodes.Aka[i].net; routeto->node = nodes.Aka[i].node; 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)); return R_ROUTE; @@ -473,7 +473,7 @@ int GetRoute(char *ftn, fidoaddr *res) dir.net = dest->net; dir.node = dest->node; dir.point = dest->point; - snprintf(dir.domain, 12, "%s", dest->domain); + snprintf(dir.domain, 13, "%s", dest->domain); /* * First direct match @@ -557,7 +557,7 @@ int GetRoute(char *ftn, fidoaddr *res) */ if (me_host != -1) { 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)) { res->zone = CFG.aka[me_host].zone; res->net = myregion; @@ -611,7 +611,7 @@ int GetRoute(char *ftn, fidoaddr *res) */ if (me_hub != -1) { 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) && (dnlent->addr.zone == CFG.aka[me_hub].zone)) { res->zone = dest->zone; @@ -648,7 +648,7 @@ int GetRoute(char *ftn, fidoaddr *res) res->zone = bnlent->addr.zone; res->net = bnlent->upnet; 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)); if (bnlent->addr.domain) free(bnlent->addr.domain); diff --git a/mbfido/utic.c b/mbfido/utic.c index 6a34cab3..42bd1a00 100644 --- a/mbfido/utic.c +++ b/mbfido/utic.c @@ -45,7 +45,7 @@ char *MakeTicName() static char buf[13]; buf[12] = '\0'; - snprintf(buf, 12, "%08lx.tic", sequencer()); + snprintf(buf, 13, "%08lx.tic", sequencer()); buf[0] = 'm'; buf[1] = 'b'; @@ -112,7 +112,7 @@ int Rearc(char *unarc) 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) { free(cmd); return TRUE; @@ -138,7 +138,7 @@ void DeleteVirusWork() buf = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char)); 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) { Syslog('f', "DeleteVirusWork %s/arc", temp); @@ -160,7 +160,7 @@ void Bad(char *format, ...) va_list va_ptr; va_start(va_ptr, format); - vsnprintf(outstr, 1023, format, va_ptr); + vsnprintf(outstr, 1024, format, va_ptr); va_end(va_ptr); WriteError(outstr); @@ -173,7 +173,7 @@ void Bad(char *format, ...) void ReCalcCrc(char *fn) { 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); } @@ -187,9 +187,9 @@ int Get_File_Id() int i, j, lines = 0; 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) { - 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) { free(temp); return FALSE; diff --git a/mbfido/virscan.c b/mbfido/virscan.c index fa2a83f7..27eb984e 100644 --- a/mbfido/virscan.c +++ b/mbfido/virscan.c @@ -48,9 +48,9 @@ int VirScan(char *path) stdlog = calloc(PATH_MAX, sizeof(char)); errlog = calloc(PATH_MAX, sizeof(char)); - snprintf(temp, PATH_MAX -1, "%s/etc/virscan.data", getenv("MBSE_ROOT")); - snprintf(stdlog, PATH_MAX -1, "%s/tmp/stdlog%d", getenv("MBSE_ROOT"), mypid); - snprintf(errlog, PATH_MAX -1, "%s/tmp/errlog%d", getenv("MBSE_ROOT"), mypid); + snprintf(temp, PATH_MAX, "%s/etc/virscan.data", getenv("MBSE_ROOT")); + snprintf(stdlog, PATH_MAX, "%s/tmp/stdlog%d", getenv("MBSE_ROOT"), mypid); + snprintf(errlog, PATH_MAX, "%s/tmp/errlog%d", getenv("MBSE_ROOT"), mypid); if ((fp = fopen(temp, "r")) == NULL) { WriteError("No virus scanners defined");