aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--env.c3
-rw-r--r--gssapi.c2
-rw-r--r--lock.c10
-rw-r--r--sink.c4
-rw-r--r--transact.c5
-rw-r--r--unmime.c4
6 files changed, 16 insertions, 12 deletions
diff --git a/env.c b/env.c
index d832811d..516040bd 100644
--- a/env.c
+++ b/env.c
@@ -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);
}
diff --git a/gssapi.c b/gssapi.c
index 3525be85..ebc32e87 100644
--- a/gssapi.c
+++ b/gssapi.c
@@ -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,
diff --git a/lock.c b/lock.c
index 7596d611..d3419dd7 100644
--- a/lock.c
+++ b/lock.c
@@ -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 */
diff --git a/sink.c b/sink.c
index 176f638c..1d379a5b 100644
--- a/sink.c
+++ b/sink.c
@@ -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"));
diff --git a/transact.c b/transact.c
index 8a477345..247d3e65 100644
--- a/transact.c
+++ b/transact.c
@@ -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");
diff --git a/unmime.c b/unmime.c
index ad402aa8..5bc8f2b0 100644
--- a/unmime.c
+++ b/unmime.c
@@ -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