From: gilles Date: Sat, 19 Apr 2014 13:57:17 +0000 (+0000) Subject: (void) cast a strlcpy() that cannot truncate X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=86d491f8f6f00598efb9d1416372169583fc52e8;p=openbsd (void) cast a strlcpy() that cannot truncate (void) cast a few snprintf()/strlcat() that cannot truncate and that would be harmless if they could --- diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index b523f8bb06b..0a13a31ad21 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.117 2014/04/04 16:10:42 eric Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.118 2014/04/19 13:57:17 gilles Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -111,7 +111,7 @@ srv_connect(void) memset(&sun, 0, sizeof(sun)); sun.sun_family = AF_UNIX; - strlcpy(sun.sun_path, SMTPD_SOCKET, sizeof(sun.sun_path)); + (void)strlcpy(sun.sun_path, SMTPD_SOCKET, sizeof(sun.sun_path)); if (connect(ctl_sock, (struct sockaddr *)&sun, sizeof(sun)) == -1) { saved_errno = errno; close(ctl_sock); @@ -959,17 +959,17 @@ show_queue_envelope(struct envelope *e, int online) if (online) { if (e->flags & EF_PENDING) - snprintf(runstate, sizeof runstate, "pending|%zi", + (void)snprintf(runstate, sizeof runstate, "pending|%zi", (ssize_t)(e->nexttry - now)); else if (e->flags & EF_INFLIGHT) - snprintf(runstate, sizeof runstate, "inflight|%zi", + (void)snprintf(runstate, sizeof runstate, "inflight|%zi", (ssize_t)(now - e->lasttry)); else - snprintf(runstate, sizeof runstate, "invalid|"); + (void)snprintf(runstate, sizeof runstate, "invalid|"); e->flags &= ~(EF_PENDING|EF_INFLIGHT); } else - strlcpy(runstate, "offline|", sizeof runstate); + (void)strlcpy(runstate, "offline|", sizeof runstate); if (e->flags) errx(1, "%016" PRIx64 ": unexpected flags 0x%04x", e->id, @@ -1018,8 +1018,8 @@ getflag(uint *bitmap, int bit, char *bitstr, char *buf, size_t len) { if (*bitmap & bit) { *bitmap &= ~bit; - strlcat(buf, bitstr, len); - strlcat(buf, ",", len); + (void)strlcat(buf, bitstr, len); + (void)strlcat(buf, ",", len); } }