From 5692da47bef5402d37e131c1d55fbad864bd066d Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sat, 11 Jul 2015 14:47:45 +0200 Subject: Fix various issues reported by Coverity --- degesch.c | 8 ++++++-- kike.c | 5 ++++- zyklonb.c | 5 ++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/degesch.c b/degesch.c index b4a1384..9730ac8 100644 --- a/degesch.c +++ b/degesch.c @@ -5003,7 +5003,10 @@ irc_handle_nick (struct server *s, const struct irc_message *msg) user_unref (buffer_collision->user); buffer_collision->user = user_ref (user); + } + if (pm_buffer && buffer_collision) + { // There's not much else we can do other than somehow try to merge // one buffer into the other. In our case, the original buffer wins. buffer_merge (s->ctx, buffer_collision, pm_buffer); @@ -6265,7 +6268,7 @@ static void config_dump_children (struct config_item_ *object, struct config_dump_data *data) { - hard_assert (object->type = CONFIG_ITEM_OBJECT); + hard_assert (object->type == CONFIG_ITEM_OBJECT); struct config_dump_level level; level.next = NULL; @@ -7788,6 +7791,7 @@ process_user_command struct command_handler *handler; if (!(handler = str_map_find (&map, command_name))) return false; + hard_assert (handler->flags == 0 || (handler->flags & HANDLER_SERVER)); if ((handler->flags & HANDLER_SERVER) && args.buffer->type == BUFFER_GLOBAL) @@ -8036,7 +8040,7 @@ static size_t utf8_common_prefix (const char **vector, size_t len) { size_t prefix = 0; - if (!vector || !vector[0]) + if (!vector || !len) return 0; struct utf8_iter a[len]; diff --git a/kike.c b/kike.c index b4f4434..c48eb3c 100644 --- a/kike.c +++ b/kike.c @@ -1818,8 +1818,11 @@ mode_processor_do_list (struct mode_processor *self, return; } + if (!mode_processor_check_operator (self)) + return; + char *mask = irc_check_expand_user_mask (target); - if (!mode_processor_check_operator (self) || !mask) + if (!mask) return; size_t i; diff --git a/zyklonb.c b/zyklonb.c index 06988d0..c2e466c 100644 --- a/zyklonb.c +++ b/zyklonb.c @@ -673,13 +673,12 @@ prepare_recovery_environment (void) break; } - if (iter) + if (*iter) g_startup_reason_location = iter; else { + g_startup_reason_location = g_recovery_env.vector + g_recovery_env.len; str_vector_add (&g_recovery_env, ""); - g_startup_reason_location = - g_recovery_env.vector + g_recovery_env.len - 1; } } -- cgit v1.2.3-70-g09d2