diff --git a/mbfido/postemail.c b/mbfido/postemail.c index c2b0b0b4..f81e1a33 100644 --- a/mbfido/postemail.c +++ b/mbfido/postemail.c @@ -4,7 +4,7 @@ * Purpose ...............: Post Email message from temp file * ***************************************************************************** - * Copyright (C) 1997-2004 + * Copyright (C) 1997-2005 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -90,7 +90,7 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo) temp = calloc(MAX_LINE_LENGTH +1, sizeof(char)); rfcaddr = parserfcaddr(MailFrom); - sprintf(temp, "MAIL FROM:<%s@%s>\r\n", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target)); + snprintf(temp, MAX_LINE_LENGTH, "MAIL FROM:<%s@%s>\r\n", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target)); Syslog('m', "%s", printable(temp, 0)); if (smtp_cmd(temp, 250)) { WriteError("SMTP: refused FROM <%s@%s>", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target)); @@ -101,7 +101,7 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo) tidyrfcaddr(rfcaddr); rfcaddr = parserfcaddr(MailTo); - sprintf(temp, "RCPT TO:<%s@%s>\r\n", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target)); + snprintf(temp, MAX_LINE_LENGTH, "RCPT TO:<%s@%s>\r\n", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target)); Syslog('m', "%s", printable(temp, 0)); if (smtp_cmd(temp, 250)) { WriteError("SMTP: refused TO <%s@%s>", MBSE_SS(rfcaddr.remainder), MBSE_SS(rfcaddr.target)); @@ -128,7 +128,7 @@ int postemail(FILE *fp, char *MailFrom, char *MailTo) } smtp_send(buf); } else { - sprintf(temp, " .\r\n"); + snprintf(temp, MAX_LINE_LENGTH, " .\r\n"); smtp_send(temp); } } diff --git a/mbfido/postnetmail.c b/mbfido/postnetmail.c index f9733af0..dd99372e 100644 --- a/mbfido/postnetmail.c +++ b/mbfido/postnetmail.c @@ -4,7 +4,7 @@ * Purpose ...............: Post Netmail message from temp file * ***************************************************************************** - * Copyright (C) 1997-2004 + * Copyright (C) 1997-2005 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -67,7 +67,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t int flags, int DoPing, unsigned int fzone, unsigned int tzone) { char *p, *msgid = NULL, *reply = NULL, *flagstr = NULL; - char name[36], *buf, *l, *r, *q, System[36], ext[4]; + char name[37], *buf, *l, *r, *q, System[37], ext[4]; int result = 1, email = FALSE, fmpt = 0, topt = 0; faddr *ta, *ra; fidoaddr na, routeto, Orig; @@ -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)) - sprintf(na.domain, "%s", fidonet.domain); + snprintf(na.domain, 12, "%s", fidonet.domain); switch(TrackMail(na, &routeto)) { case R_LOCAL: @@ -255,12 +255,12 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t * Check the To: field. */ if (strchr(t->name, '@') != NULL) { - sprintf(name, "%s", strtok(t->name, "@")); - sprintf(System, "%s", strtok(NULL, "\000")); + snprintf(name, 36, "%s", strtok(t->name, "@")); + snprintf(System, 36, "%s", strtok(NULL, "\000")); email = TRUE; } else { - sprintf(name, "%s", t->name); - sprintf(System, "%s", CFG.sysdomain); + snprintf(name, 36, "%s", t->name); + snprintf(System, 36, "%s", CFG.sysdomain); } if (email) { @@ -278,7 +278,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t (strcasecmp(name, "postmaster") == 0) || (strcasecmp(name, "coordinator") == 0)) { Syslog('+', " Readdress from %s to %s", name, CFG.sysop_name); - sprintf(name, "%s", CFG.sysop_name); + snprintf(name, 36, "%s", CFG.sysop_name); } /* @@ -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)); - sprintf(p, "%s/etc/service.data", getenv("MBSE_ROOT")); + snprintf(p, PATH_MAX -1, "%s/etc/service.data", getenv("MBSE_ROOT")); if ((sfp = fopen(p, "r")) == NULL) { WriteError("$Can't open %s", p); } else { @@ -339,7 +339,7 @@ int postnetmail(FILE *fp, faddr *f, faddr *t, char *orig, char *subject, time_t */ net_bad++; Syslog('+', " Readdress from %s to %s", name, CFG.sysop_name); - sprintf(name, "%s", CFG.sysop_name); + snprintf(name, 36, "%s", CFG.sysop_name); if (SearchUser(name)) { return storenet(f, t, mdate, flags, subject, msgid, reply, fp, flagstr); } 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) - sprintf(ext, (char *)"qqq"); + snprintf(ext, 3, (char *)"qqq"); else if (nodes.Crash) - sprintf(ext, (char *)"ccc"); + snprintf(ext, 3, (char *)"ccc"); else if (nodes.Hold) - sprintf(ext, (char *)"hhh"); + snprintf(ext, 3, (char *)"hhh"); else - sprintf(ext, (char *)"nnn"); + snprintf(ext, 3, (char *)"nnn"); if ((net = OpenPkt(Orig , routeto, (char *)ext)) == NULL) { net_bad++; diff --git a/mbfido/ptic.c b/mbfido/ptic.c index 0863082e..46be5a46 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. */ - sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName); + snprintf(Temp, PATH_MAX -1, "%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; } - sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicIn.File); + snprintf(Temp, PATH_MAX -1, "%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()) { - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicName); + snprintf(temp1, PATH_MAX -1, "%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 { - sprintf(Temp, "%s/etc/fareas.data", getenv("MBSE_ROOT")); + snprintf(Temp, PATH_MAX -1, "%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)) { - sprintf(Temp, "%s%s", TIC.TicIn.Area, TIC.TicIn.Crc); + snprintf(Temp, PATH_MAX -1, "%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)) { - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File); - sprintf(temp2, "%s/%s", CFG.ticout, TIC.TicIn.File); + snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicIn.File); + snprintf(temp2, PATH_MAX -1, "%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. */ - sprintf(temp2, "%s/tmp/arc", getenv("MBSE_ROOT")); + snprintf(temp2, PATH_MAX -1, "%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 */ - sprintf(temp1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); if (!unlink(temp1)) Syslog('+', "Removed stale %s", temp1); - sprintf(temp1, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX -1, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); if (!unlink(temp1)) Syslog('+', "Removed stale %s", temp1); - sprintf(temp1, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX -1, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); if (!unlink(temp1)) Syslog('+', "Removed stale %s", temp1); - sprintf(temp1, "%s/tmp/file_id.diz", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX -1, "%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 { - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File); + snprintf(temp1, PATH_MAX -1, "%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 */ - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File); - sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), TIC.TicIn.File); + 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); 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; } - sprintf(temp2, "%s/tmp/arc", getenv("MBSE_ROOT")); + snprintf(temp2, PATH_MAX -1, "%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) { - sprintf(temp1, "%s/tmp/arc/FILE_ID.DIZ", getenv("MBSE_ROOT")); - sprintf(temp2, "%s/tmp/FILE_ID.DIZ", getenv("MBSE_ROOT")); + 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")); if (file_cp(temp1, temp2) == 0) { File_Id = TRUE; } else { - sprintf(temp1, "%s/tmp/arc/file_id.diz", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX -1, "%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 { - sprintf(temp1, "%s/tmp", getenv("MBSE_ROOT")); + snprintf(temp1, PATH_MAX -1, "%s/tmp", getenv("MBSE_ROOT")); chdir(temp1); - sprintf(temp1, "%s/%s FILE_ID.DIZ", TIC.Inbound, TIC.TicIn.File); + snprintf(temp1, PATH_MAX -1, "%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 { - sprintf(temp1, "%s/%s file_id.diz", TIC.Inbound, TIC.TicIn.File); + snprintf(temp1, PATH_MAX -1, "%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 */ - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile); + snprintf(temp1, PATH_MAX -1, "%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 { - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewFile); - sprintf(Temp, "%s/etc/%s", getenv("MBSE_ROOT"), tic.Banner); + snprintf(temp1, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.NewFile); + snprintf(Temp, PATH_MAX -1, "%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. */ - sprintf(Temp, "%s/%s", TIC.Inbound, TIC.NewFile); + snprintf(Temp, PATH_MAX -1, "%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. */ - sprintf(temp1, "%s/%s", TIC.Inbound, TIC.TicIn.File); + snprintf(temp1, PATH_MAX -1, "%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)) { - sprintf(sbe, "%u:%u/%u", CFG.aka[i].zone, CFG.aka[i].net, CFG.aka[i].node); + snprintf(sbe, 23, "%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) { - sprintf(sbe, "%u:%u/%u", tmpq->aka.zone, tmpq->aka.net, tmpq->aka.node); + snprintf(sbe, 23, "%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(); - sprintf(Temp, "%s/%s", TIC.Inbound, TIC.TicName); + snprintf(Temp, PATH_MAX -1, "%s/%s", TIC.Inbound, TIC.TicName); unlink(Temp); free(Temp); diff --git a/mbfido/queue.c b/mbfido/queue.c index 86d16ad0..0baa71b7 100644 --- a/mbfido/queue.c +++ b/mbfido/queue.c @@ -4,7 +4,7 @@ * Purpose ...............: Mail and file queue operations * ***************************************************************************** - * Copyright (C) 1997-2004 + * Copyright (C) 1997-2005 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -79,7 +79,7 @@ void flush_dir(char *ndir) fd_list *fdl = NULL; temp = calloc(PATH_MAX, sizeof(char)); - sprintf(temp, "%s/%s", CFG.out_queue, ndir); + snprintf(temp, PATH_MAX -1, "%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; - sprintf(nodenr.domain, "%s", noden.domain); + snprintf(nodenr.domain, 12, "%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. */ - sprintf(arcfile, "%s/%08lx.%s0", nodes.Dir_out_path, StringCRC32(ascfnode(&noden, 0x1f)), ext); + snprintf(arcfile, PATH_MAX -1, "%s/%08lx.%s0", nodes.Dir_out_path, StringCRC32(ascfnode(&noden, 0x1f)), ext); } else { bestaka = bestaka_s(&noden); if (noden.point) { - sprintf(arcfile, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, + snprintf(arcfile, PATH_MAX -1, "%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 */ - sprintf(arcfile, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, + snprintf(arcfile, PATH_MAX -1, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, ((bestaka->node) - (noden.node) - (bestaka->point)) & 0xffff, ext); } else { - sprintf(arcfile, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, + snprintf(arcfile, PATH_MAX -1, "%s/%04x%04x.%s0", nodes.Dir_out_path, ((bestaka->net) - (noden.net)) & 0xffff, ((bestaka->node) - (noden.node)) &0xffff, ext); } } } else { - sprintf(arcfile, "%s", arcname(&noden, nodes.Aka[0].zone, nodes.ARCmailCompat)); + snprintf(arcfile, PATH_MAX -1, "%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)); - sprintf(fname, "%s/mailpkt.qqq", temp); + snprintf(fname, PATH_MAX -1, "%s/mailpkt.qqq", temp); if (access(fname, W_OK) == 0) { - sprintf(pktfile, "%s/%08lx.pkt", temp, sequencer()); + snprintf(pktfile, PATH_MAX -1, "%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; } - sprintf(pktfile, "%s/%s", temp, fname); + snprintf(pktfile, PATH_MAX -1, "%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) { - sprintf(arcfile, "%s/%08lx.pkt", nodes.Dir_out_path, sequencer()); + snprintf(arcfile, PATH_MAX -1, "%s/%08lx.pkt", nodes.Dir_out_path, sequencer()); } else { - sprintf(arcfile, "%s", pktname(&noden, flavor)); + snprintf(arcfile, PATH_MAX -1, "%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. */ - sprintf(pktfile, "%s/.filelist", temp); + snprintf(pktfile, PATH_MAX -1, "%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) { - sprintf(arcfile, "%s/%s", nodes.Dir_out_path, Basename(p)); + snprintf(arcfile, PATH_MAX -1, "%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)); - sprintf(temp, "%s/foobar", CFG.out_queue); + snprintf(temp, PATH_MAX -1, "%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, "..")) { - sprintf(temp, "%s/%s", CFG.out_queue, de->d_name); + snprintf(temp, PATH_MAX -1, "%s/%s", CFG.out_queue, de->d_name); Syslog('p', "Queue directory %s", temp); flush_dir(de->d_name); if (chdir(CFG.out_queue))