From: Jeremy Harris Date: Fri, 4 Mar 2016 11:58:27 +0000 (+0000) Subject: tidying: coverity issues X-Git-Tag: exim-4_87_RC6~7 X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/cb570b5ea1ff234ae16b2c32a236ccd520a80f7a tidying: coverity issues --- diff --git a/src/src/header.c b/src/src/header.c index 8136c69fe..e6f41b8b9 100644 --- a/src/src/header.c +++ b/src/src/header.c @@ -450,10 +450,11 @@ for (s = strings; s != NULL; s = s->next) va_start(ap, count); for (i = 0; i < count; i++) - { if (one_pattern_match(name, slen, has_addresses, va_arg(ap, uschar *))) + { + va_end(ap); return cond; - } + } va_end(ap); return !cond; diff --git a/src/src/malware.c b/src/src/malware.c index 9dd241b8c..9451392f2 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -657,7 +657,6 @@ if (!malware_ok) "unable to send file body to socket (%s)", scanner_options), sock); } - (void)close(drweb_fd); } else { @@ -1304,11 +1303,8 @@ if (!malware_ok) /* parse options */ /*XXX should these options be common over scanner types? */ if (clamd_option(cd, sublist, &subsep) != OK) - { return m_errlog_defer(scanent, NULL, string_sprintf("bad option '%s'", scanner_options)); - continue; - } cv[num_servers++] = cd; if (num_servers >= MAX_CLAMD_SERVERS) diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c index 69db3101f..3aac759eb 100644 --- a/src/src/pdkim/pdkim.c +++ b/src/src/pdkim/pdkim.c @@ -831,9 +831,6 @@ for (p = raw_record; ; p++) if (!cur_val) cur_val = pdkim_strnew(NULL); - if (c == '\r' || c == '\n') - goto NEXT_CHAR; - if (c == ';' || c == '\0') { if (cur_tag->len > 0) @@ -1755,6 +1752,13 @@ while (sig) if (!(sig->signature_header = pdkim_create_header(sig, TRUE))) return PDKIM_ERR_OOM; + + /* We only ever sign with one sig, and we free'd "headernames" + above. So to keep static-analysers happy, exit the loop explicitly. + Perhaps the code would be more clear if signing and verification + loops were separated? */ + + break; } /* VERIFICATION ----------------------------------------------------------- */ diff --git a/src/src/regex.c b/src/src/regex.c index 3852ad8c5..b3ef31c3e 100644 --- a/src/src/regex.c +++ b/src/src/regex.c @@ -112,7 +112,12 @@ if (!mime_stream) /* We are in the DATA ACL */ } else { - f_pos = ftell(mime_stream); + if ((f_pos = ftell(mime_stream)) < 0) + { + log_write(0, LOG_MAIN|LOG_PANIC, + "regex acl condition: mime_stream: %s", strerror(errno)); + return DEFER; + } mbox_file = mime_stream; } diff --git a/src/src/routers/redirect.c b/src/src/routers/redirect.c index 7bbaa82e4..2efb42160 100644 --- a/src/src/routers/redirect.c +++ b/src/src/routers/redirect.c @@ -553,6 +553,12 @@ addr_prop.remove_headers = NULL; #ifdef EXPERIMENTAL_SRS addr_prop.srs_sender = NULL; #endif +#ifdef SUPPORT_I18N +addr_prop.utf8_msg = FALSE; /*XXX should we not copy this from the parent? */ +addr_prop.utf8_downcvt = FALSE; +addr_prop.utf8_downcvt_maybe = FALSE; +#endif + /* When verifying and testing addresses, the "logwrite" command in filters must be bypassed. */ diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 0498ecb18..202fcf1bb 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -3323,9 +3323,9 @@ while (done <= 0) smtp_cmd_data = NULL; if (smtp_in_auth(au, &s, &ss) == OK) - DEBUG(D_auth) debug_printf("tls auth succeeded\n"); + { DEBUG(D_auth) debug_printf("tls auth succeeded\n"); } else - DEBUG(D_auth) debug_printf("tls auth not succeeded\n"); + { DEBUG(D_auth) debug_printf("tls auth not succeeded\n"); } break; } } diff --git a/src/src/string.c b/src/src/string.c index e0e0fa5ae..b559a9f19 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -1518,6 +1518,7 @@ specified messages. If it does, the message just gets truncated, and there doesn't seem much we can do about that. */ (void)string_vformat(buffer+15, sizeof(buffer) - 15, format, ap); +va_end(ap); return (eno == EACCES)? string_sprintf("%s: %s (euid=%ld egid=%ld)", buffer, strerror(eno), diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c index 1f4d7a6bf..7c091cb59 100644 --- a/src/src/transports/lmtp.c +++ b/src/src/transports/lmtp.c @@ -217,6 +217,7 @@ va_list ap; va_start(ap, format); if (!string_vformat(big_buffer, big_buffer_size, CS format, ap)) { + va_end(ap); errno = ERRNO_SMTPFORMAT; return FALSE; }