From 9e7e0f6a60dea9e21aac8b4ea5f8725bdc52a743 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 29 Jan 2017 22:58:47 +0000 Subject: [PATCH] Tidying: Coverity --- src/src/dns.c | 5 +++-- src/src/smtp_in.c | 3 ++- src/src/transports/smtp.c | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/src/dns.c b/src/src/dns.c index 815a978e9..63e31b2c4 100644 --- a/src/src/dns.c +++ b/src/src/dns.c @@ -765,8 +765,9 @@ dnsa->answerlen = running_in_test_harness if (dnsa->answerlen > (int) sizeof(dnsa->answer)) { - DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) resulted in overlong packet (size %d), truncating to %d.\n", - name, dns_text_type(type), dnsa->answerlen, sizeof(dnsa->answer)); + DEBUG(D_dns) debug_printf("DNS lookup of %s (%s) resulted in overlong packet" + " (size %d), truncating to %u.\n", + name, dns_text_type(type), dnsa->answerlen, (unsigned int) sizeof(dnsa->answer)); dnsa->answerlen = sizeof(dnsa->answer); } diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index fa4bb99ed..91b1c7e6d 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -977,7 +977,7 @@ int get_ok = 0; int size, ret; int fd = fileno(smtp_in); const char v2sig[12] = "\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A"; -uschar *iptype; /* To display debug info */ +uschar * iptype; /* To display debug info */ struct timeval tv; struct timeval tvtmp; socklen_t vslen = sizeof(struct timeval); @@ -1095,6 +1095,7 @@ if (ret >= 16 && memcmp(&hdr.v2, v2sig, 12) == 0) break; case 0x00: /* LOCAL command */ /* Keep local connection address for LOCAL */ + iptype = US"local"; break; default: DEBUG(D_receive) diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 95bee582d..81da5b0a8 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1858,6 +1858,7 @@ if ( smtp_peer_options & PEER_OFFERED_TLS ) { Ustrncpy(sx->buffer, buffer2, sizeof(sx->buffer)); + sx->buffer[sizeof(sx->buffer)-1] = '\0'; goto RESPONSE_FAILED; } } @@ -3189,7 +3190,7 @@ if (sx.completed_addr && sx.ok && sx.send_quit) if (! (sx.ok = smtp_write_command(&sx.outblock, FALSE, "RSET\r\n") >= 0)) { msg = US string_sprintf("send() to %s [%s] failed: %s", host->name, - host->address, strerror(save_errno)); + host->address, strerror(errno)); sx.send_quit = FALSE; } else if (! (sx.ok = smtp_read_response(&sx.inblock, sx.buffer, -- 2.25.1