diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-06-23 14:50:12 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-06-23 14:50:12 +0000 |
commit | 75b1a90747d6fa2d0d2962856c2875b92ebcfe7b (patch) | |
tree | 7431f59f25204ad0d0d672dcd68466d2ef30631c /sink.c | |
parent | c55e6971c9006e85f25e9ef758b8980d8920e149 (diff) | |
download | fetchmail-75b1a90747d6fa2d0d2962856c2875b92ebcfe7b.tar.gz fetchmail-75b1a90747d6fa2d0d2962856c2875b92ebcfe7b.tar.bz2 fetchmail-75b1a90747d6fa2d0d2962856c2875b92ebcfe7b.zip |
strncat/snprintf cleanup.
svn path=/trunk/; revision=3366
Diffstat (limited to 'sink.c')
-rw-r--r-- | sink.c | 32 |
1 files changed, 23 insertions, 9 deletions
@@ -293,7 +293,11 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg, return(FALSE); /* our first duty is to keep the sacred foo counters turning... */ - sprintf(boundary, +#ifdef HAVE_SNPRINTF + snprintf(boundary, sizeof(boundary), +#else + sprintf(boundary, +#endif /* HAVE_SNPRINTF */ "foo-mani-padme-hum-%d-%d-%ld", (int)getpid(), (int)getppid(), time((time_t *)NULL)); @@ -613,14 +617,24 @@ int open_sink(struct query *ctl, struct msgblk *msg, */ if (!msg->return_path[0]) { - sprintf(addr, "%s@%s", ctl->remotename, ctl->server.truename); +#ifdef HAVE_SNPRINTF + snprintf(addr, sizeof(addr), +#else + sprintf(addr, +#endif /* HAVE_SNPRINTF */ + "%s@%s", ctl->remotename, ctl->server.truename); ap = addr; } else if (strchr(msg->return_path, '@')) ap = msg->return_path; else /* in case Return-Path existed but was local */ { - sprintf(addr, "%s@%s", msg->return_path, ctl->server.truename); +#ifdef HAVE_SNPRINTF + snprintf(addr, sizeof(addr), +#else + sprintf(addr, +#endif /* HAVE_SNPRINTF */ + "%s@%s", msg->return_path, ctl->server.truename); ap = addr; } @@ -660,7 +674,6 @@ int open_sink(struct query *ctl, struct msgblk *msg, else { char errbuf[POPBUFSIZE]; - int res; #ifdef __UNUSED__ /* @@ -675,13 +688,14 @@ int open_sink(struct query *ctl, struct msgblk *msg, * also as the body is discarded after calling * RSET! */ + int res; if ((res = handle_smtp_report(ctl, msg))==PS_REFUSED) return(PS_REFUSED); #endif /* __UNUSED__ */ - strcpy(errbuf, idp->id); - strcat(errbuf, ": "); - strcat(errbuf, smtp_response); + strncpy(errbuf, idp->id, sizeof(errbuf)); + strncat(errbuf, ": ", sizeof(errbuf)); + strncat(errbuf, smtp_response, sizeof(errbuf)); xalloca(from_responses[*bad_addresses], char *, @@ -710,7 +724,7 @@ int open_sink(struct query *ctl, struct msgblk *msg, if (!(*good_addresses)) { if (strchr(run.postmaster, '@')) - strcpy(addr, run.postmaster); + strncpy(addr, run.postmaster, sizeof(addr)); else { #ifdef HAVE_SNPRINTF @@ -1167,7 +1181,7 @@ va_dcl #endif va_end(ap); - strcat(buf, "\r\n"); + strncat(buf, "\r\n", sizeof(buf)); stuffline(ctl, buf); } |