Mercurial > dovecot > core-2.2
changeset 17476:4a396f0c3b79
Added various asserts to try to silence Coverity false positives.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 13 Jun 2014 01:57:04 +0300 |
parents | d26130954761 |
children | 2e7987633f8b |
files | src/auth/auth-request.c src/lib-imap-client/imapc-client.c src/lib-index/mail-index-map-read.c src/lib-settings/settings.c src/lib-storage/index/dbox-common/dbox-save.c src/lib-storage/index/mbox/mbox-save.c src/lib-storage/list/mailbox-list-index-sync.c src/lib/connection.c src/lib/ioloop-notify-inotify.c src/master/main.c |
diffstat | 10 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-request.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/auth/auth-request.c Fri Jun 13 01:57:04 2014 +0300 @@ -2151,15 +2151,18 @@ if (subsystem == AUTH_SUBSYS_DB) { if (!auth_request->userdb_lookup) { + i_assert(auth_request->passdb != NULL); name = auth_request->passdb->set->name[0] != '\0' ? auth_request->passdb->set->name : auth_request->passdb->passdb->iface.name; } else { + i_assert(auth_request->userdb != NULL); name = auth_request->userdb->set->name[0] != '\0' ? auth_request->userdb->set->name : auth_request->userdb->userdb->iface->name; } } else if (subsystem == AUTH_SUBSYS_MECH) { + i_assert(auth_request->mech == NULL); name = t_str_lcase(auth_request->mech->mech_name); } else { name = subsystem;
--- a/src/lib-imap-client/imapc-client.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib-imap-client/imapc-client.c Fri Jun 13 01:57:04 2014 +0300 @@ -411,6 +411,7 @@ } /* fallback to whatever exists (there always exists one) */ + i_assert(conn != NULL); return imapc_connection_get_capabilities(conn); }
--- a/src/lib-index/mail-index-map-read.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib-index/mail-index-map-read.c Fri Jun 13 01:57:04 2014 +0300 @@ -306,6 +306,7 @@ build it from the transaction log. */ return 1; } + i_assert(index->fd != -1); if ((index->flags & MAIL_INDEX_OPEN_FLAG_NFS_FLUSH) != 0) nfs_flush_attr_cache_fd_locked(index->filepath, index->fd);
--- a/src/lib-settings/settings.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib-settings/settings.c Fri Jun 13 01:57:04 2014 +0300 @@ -356,6 +356,7 @@ if (skip > 0) skip--; else { + i_assert(sect_callback != NULL); sect_callback(NULL, NULL, context, &errormsg); if (root_section == sections &&
--- a/src/lib-storage/index/dbox-common/dbox-save.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-save.c Fri Jun 13 01:57:04 2014 +0300 @@ -102,6 +102,8 @@ struct mail_save_data *mdata = &ctx->ctx.data; struct ostream *dbox_output = ctx->dbox_output; + i_assert(mdata->output != NULL); + if (mdata->attach != NULL && !ctx->failed) { if (index_attachment_save_finish(&ctx->ctx) < 0) ctx->failed = TRUE;
--- a/src/lib-storage/index/mbox/mbox-save.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib-storage/index/mbox/mbox-save.c Fri Jun 13 01:57:04 2014 +0300 @@ -768,6 +768,7 @@ int ret = 0; i_assert(ctx->finished); + i_assert(mbox->mbox_fd != -1); if (fstat(mbox->mbox_fd, &st) < 0) { mbox_set_syscall_error(mbox, "fstat()");
--- a/src/lib-storage/list/mailbox-list-index-sync.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib-storage/list/mailbox-list-index-sync.c Fri Jun 13 01:57:04 2014 +0300 @@ -175,6 +175,7 @@ buffer_append(hdr_buf, id_p, sizeof(*id_p)); name = hash_table_lookup(ilist->mailbox_names, POINTER_CAST(*id_p)); + i_assert(name != NULL); buffer_append(hdr_buf, name, strlen(name) + 1); prev_id = *id_p; }
--- a/src/lib/connection.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib/connection.c Fri Jun 13 01:57:04 2014 +0300 @@ -325,6 +325,7 @@ case CONNECTION_BEHAVIOR_ALLOW: return -2; } + i_unreached(); case -1: /* disconnected */ conn->disconnect_reason =
--- a/src/lib/ioloop-notify-inotify.c Fri Jun 13 01:52:13 2014 +0300 +++ b/src/lib/ioloop-notify-inotify.c Fri Jun 13 01:57:04 2014 +0300 @@ -61,6 +61,7 @@ break; event = (struct inotify_event *)(event_buf + pos); + i_assert(event->len < ret); pos += sizeof(*event) + event->len; io = io_notify_fd_find(&ctx->fd_ctx, event->wd);