(void) cast snprintf() and strlcat() calls that cannot truncate
authorgilles <gilles@openbsd.org>
Sat, 19 Apr 2014 13:35:51 +0000 (13:35 +0000)
committergilles <gilles@openbsd.org>
Sat, 19 Apr 2014 13:35:51 +0000 (13:35 +0000)
usr.sbin/smtpd/mta_session.c

index 8aa9a99..b80cf50 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mta_session.c,v 1.59 2014/04/08 12:44:57 gilles Exp $ */
+/*     $OpenBSD: mta_session.c,v 1.60 2014/04/19 13:35:51 gilles Exp $ */
 
 /*
  * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1007,7 +1007,7 @@ mta_response(struct mta_session *s, char *line)
                        stat_decrement("mta.envelope", 1);
 
                        /* log right away */
-                       snprintf(buf, sizeof(buf), "%s",
+                       (void)snprintf(buf, sizeof(buf), "%s",
                            mta_host_to_text(s->route->dst));
 
                        e->session = s->id;
@@ -1353,7 +1353,7 @@ mta_flush_task(struct mta_session *s, int delivery, const char *error, size_t co
        socklen_t                sa_len;
        const char              *domain;
 
-       snprintf(relay, sizeof relay, "%s", mta_host_to_text(s->route->dst));
+       (void)snprintf(relay, sizeof relay, "%s", mta_host_to_text(s->route->dst));
        n = 0;
        while ((e = TAILQ_FIRST(&s->task->envelopes))) {
 
@@ -1500,7 +1500,7 @@ mta_start_tls(struct mta_session *s)
                certname = s->helo;
 
        req_ca_cert.reqid = s->id;
-       strlcpy(req_ca_cert.name, certname, sizeof req_ca_cert.name);
+       (void)strlcpy(req_ca_cert.name, certname, sizeof req_ca_cert.name);
        m_compose(p_lka, IMSG_MTA_SSL_INIT, 0, 0, -1,
            &req_ca_cert, sizeof(req_ca_cert));
        tree_xset(&wait_ssl_init, s->id, s);
@@ -1604,16 +1604,16 @@ dsn_strnotify(uint8_t arg)
 
        buf[0] = '\0';
        if (arg & DSN_SUCCESS)
-               strlcat(buf, "SUCCESS,", sizeof(buf));
+               (void)strlcat(buf, "SUCCESS,", sizeof(buf));
 
        if (arg & DSN_FAILURE)
-               strlcat(buf, "FAILURE,", sizeof(buf));
+               (void)strlcat(buf, "FAILURE,", sizeof(buf));
 
        if (arg & DSN_DELAY)
-               strlcat(buf, "DELAY,", sizeof(buf));
+               (void)strlcat(buf, "DELAY,", sizeof(buf));
 
        if (arg & DSN_NEVER)
-               strlcat(buf, "NEVER,", sizeof(buf));
+               (void)strlcat(buf, "NEVER,", sizeof(buf));
 
        /* trim trailing comma */
        sz = strlen(buf);