diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-10-04 01:23:52 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-10-04 01:23:52 +0000 |
commit | 2ebf2c1b162a0425678904c8380465d963af4402 (patch) | |
tree | 72c07aff5e9c3b76f67bdbb7ef6557198680df3a | |
parent | 5b05b5c1bfb2962e9f00f6c83940a695b0725be1 (diff) | |
download | fetchmail-2ebf2c1b162a0425678904c8380465d963af4402.tar.gz fetchmail-2ebf2c1b162a0425678904c8380465d963af4402.tar.bz2 fetchmail-2ebf2c1b162a0425678904c8380465d963af4402.zip |
Length checking on tag generation.
svn path=/trunk/; revision=1473
-rw-r--r-- | driver.c | 12 | ||||
-rw-r--r-- | fetchmail.h | 10 |
2 files changed, 17 insertions, 5 deletions
@@ -80,7 +80,7 @@ static jmp_buf restart; char tag[TAGLEN]; static int tagnum; -#define GENSYM (sprintf(tag, "a%04d", ++tagnum), tag) +#define GENSYM (sprintf(tag, "a%04d", ++tagnum % TAGMOD), tag) static char *shroud; /* string to shroud in debug output, if non-NULL */ static int mytimeout; /* value of nonreponse timeout */ @@ -785,7 +785,11 @@ int num; /* index of message */ */ if (headers == (char *)NULL) { +#ifdef HAVE_SNPRINTF + snprintf(buf, sizeof(buf), +#else sprintf(buf, +#endif /* HAVE_SNPRINTF */ "From: <FETCHMAIL-DAEMON@%s>\r\nTo: %s@localhost\r\nSubject: Headerless mail from %s's mailbox on %s\r\n", fetchmailhost, user, ctl->remotename, realname); headers = xstrdup(buf); @@ -969,13 +973,13 @@ int num; /* index of message */ options[0] = '\0'; if (ctl->server.esmtp_options & ESMTP_8BITMIME) if (ctl->pass8bits) - sprintf(options, " BODY=8BITMIME"); + strcpy(options, " BODY=8BITMIME"); else if ((ctt_offs >= 0) && (ctt = nxtaddr(headers + ctt_offs))) { if (!strcasecmp(ctt,"7BIT")) - sprintf(options, " BODY=7BIT"); + strcpy(options, " BODY=7BIT"); else if (!strcasecmp(ctt,"8BIT")) - sprintf(options, " BODY=8BITMIME"); + strcpy(options, " BODY=8BITMIME"); } if ((ctl->server.esmtp_options & ESMTP_SIZE) && reallen > 0) sprintf(options + strlen(options), " SIZE=%ld", reallen); diff --git a/fetchmail.h b/fetchmail.h index 765e261c..1b033a21 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -175,8 +175,16 @@ struct method flag retry; /* can getrange poll for new messages? */ }; -#define TAGLEN 6 +/* + * Note: tags are generated with an a%04d format from a 1-origin + * integer sequence number. Length 4 permits transaction numbers + * up to 9999, so we force rollover with % 10000. There's no special + * reason for this format other than to look like the exmples in the + * IMAP RFCs. + */ +#define TAGLEN 6 /* 'a' + 4 digits + NUL */ extern char tag[TAGLEN]; +#define TAGMOD 10000 /* list of hosts assembled from run control file and command line */ extern struct query cmd_opts, *querylist; |