diff options
-rw-r--r-- | env.c | 3 | ||||
-rw-r--r-- | gssapi.c | 2 | ||||
-rw-r--r-- | lock.c | 10 | ||||
-rw-r--r-- | sink.c | 4 | ||||
-rw-r--r-- | transact.c | 5 | ||||
-rw-r--r-- | unmime.c | 4 |
6 files changed, 16 insertions, 12 deletions
@@ -190,7 +190,8 @@ static char *tzoffset(time_t *now) } if (off >= 24 * 60) /* should be impossible */ off = 23 * 60 + 59; /* if not, insert silly value */ - sprintf(offset_string, "%c%02d%02d", sign, off / 60, off % 60); + snprintf(offset_string, sizeof(offset_string), + "%c%02d%02d", sign, off / 60, off % 60); return (offset_string); } @@ -57,7 +57,7 @@ int do_gssauth(int sock, char *command, char *service, char *hostname, char *use int result; /* first things first: get an imap ticket for host */ - sprintf(buf1, "%s@%s", service, hostname); + snprintf(buf1, sizeof(buf1), "%s@%s", service, hostname); request_buf.value = buf1; request_buf.length = strlen(buf1) + 1; maj_stat = gss_import_name(&min_stat, &request_buf, GSS_C_NT_HOSTBASED_SERVICE, @@ -32,7 +32,9 @@ void lock_setup(void) if (getuid() == ROOT_UID) { lockfile = (char *)xmalloc( sizeof(PID_DIR) + sizeof(FETCHMAIL_PIDFILE) + 1); - sprintf(lockfile, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE); + strcpy(lockfile, PID_DIR); + strcat(lockfile, "/"); + strcat(lockfile, FETCHMAIL_PIDFILE); } else { lockfile = (char *)xmalloc(strlen(fmhome)+sizeof(FETCHMAIL_PIDFILE)+2); strcpy(lockfile, fmhome); @@ -98,7 +100,7 @@ void lock_or_die(void) /* get a lock on a given host or exit */ { int fd; - char tmpbuf[20]; + char tmpbuf[50]; #ifndef O_SYNC #define O_SYNC 0 /* use it if we have it */ @@ -107,11 +109,11 @@ void lock_or_die(void) { if ((fd = open(lockfile, O_WRONLY|O_CREAT|O_EXCL|O_SYNC, 0666)) != -1) { - sprintf(tmpbuf,"%d", getpid()); + snprintf(tmpbuf, sizeof(tmpbuf), "%ld", (long)getpid()); write(fd, tmpbuf, strlen(tmpbuf)); if (run.poll_interval) { - sprintf(tmpbuf," %d", run.poll_interval); + snprintf(tmpbuf, sizeof(tmpbuf), " %d", run.poll_interval); write(fd, tmpbuf, strlen(tmpbuf)); } close(fd); /* should be safe, fd was opened with O_SYNC */ @@ -325,8 +325,8 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg, } /* our first duty is to keep the sacred foo counters turning... */ - snprintf(boundary, sizeof(boundary), "foo-mani-padme-hum-%d-%d-%ld", - (int)getpid(), (int)getppid(), time((time_t *)NULL)); + snprintf(boundary, sizeof(boundary), "foo-mani-padme-hum-%ld-%ld-%ld", + (long)getpid(), (long)getppid(), time(NULL)); if (outlevel >= O_VERBOSE) report(stdout, GT_("SMTP: (bounce-message body)\n")); @@ -1148,8 +1148,9 @@ int readheaders(int sock, VERSION); if (ctl->tracepolls) { - sprintf(buf + strlen(buf), " polling %s account %s", - ctl->server.pollname, + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + " polling %s account %s", + ctl->server.pollname, ctl->remotename); } snprintf(buf+strlen(buf), sizeof(buf)-strlen(buf), ")\r\n"); @@ -669,9 +669,9 @@ int main(int argc, char *argv[]) char fnam[100]; pid = getpid(); - sprintf(fnam, "/tmp/i_unmime.%x", pid); + sprintf(fnam, "/tmp/i_unmime.%lx", (long)pid); fd_orig = fopen(fnam, "w"); - sprintf(fnam, "/tmp/o_unmime.%x", pid); + sprintf(fnam, "/tmp/o_unmime.%lx", (long)pid); fd_conv = fopen(fnam, "w"); #endif |