/pidgin/main: cd7db320cf5c: Fix coverity regression warnings
Tomasz Wasilczyk <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: cd7db320cf5c1ac2db8a95f71fe8f9532a5c7905 Author: Tomasz Wasilczyk <[email protected]> Date: 2014-05-12 23:32 +0200 Branch: release-2.x.y URL: https://hg.pidgin.im/pidgin/main/rev/cd7db320cf5c Description: Fix coverity regression warnings diffstat: finch/libgnt/gnttextview.c | 4 ++++ libpurple/dnssrv.c | 8 ++++++++ libpurple/plugins/log_reader.c | 2 ++ libpurple/protocols/yahoo/yahoo_profile.c | 2 +- libpurple/protocols/zephyr/ZReadAscii.c | 2 +- libpurple/protocols/zephyr/zephyr.c | 4 ++-- pidgin/gtkprefs.c | 5 ++++- pidgin/plugins/perl/common/GtkIMHtml.xs | 2 +- 8 files changed, 23 insertions(+), 6 deletions(-) diffs (116 lines): diff --git a/finch/libgnt/gnttextview.c b/finch/libgnt/gnttextview.c --- a/finch/libgnt/gnttextview.c +++ b/finch/libgnt/gnttextview.c @@ -766,6 +766,10 @@ int gnt_text_view_tag_change(GntTextView for (segs = line->segments; segs; segs = snext) { GntTextSegment *seg = segs->data; + + if (!line) + break; + snext = segs->next; if (seg->start >= tag->end) { /* The segment is somewhere after the tag */ diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c --- a/libpurple/dnssrv.c +++ b/libpurple/dnssrv.c @@ -544,6 +544,14 @@ resolved(gpointer data, gint source, Pur responses = NULL; break; } + if (len > MAX_ADDR_RESPONSE_LEN) { + purple_debug_error("dnssrv", "we've read invalid number\n"); + size = 0; + g_list_foreach(responses, (GFunc)purple_txt_response_destroy, NULL); + g_list_free(responses); + responses = NULL; + break; + } res = g_new0(PurpleTxtResponse, 1); res->content = g_new0(gchar, len); diff --git a/libpurple/plugins/log_reader.c b/libpurple/plugins/log_reader.c --- a/libpurple/plugins/log_reader.c +++ b/libpurple/plugins/log_reader.c @@ -2003,6 +2003,8 @@ static char *qip_logger_read(PurpleLog * /* find EOL */ c = strchr(c, '\n'); + if (!c) + break; /* XXX: Do we need buddy_name when we have buddy->alias? */ buddy_name = ++c; diff --git a/libpurple/protocols/yahoo/yahoo_profile.c b/libpurple/protocols/yahoo/yahoo_profile.c --- a/libpurple/protocols/yahoo/yahoo_profile.c +++ b/libpurple/protocols/yahoo/yahoo_profile.c @@ -1023,7 +1023,7 @@ yahoo_got_photo(PurpleUtilFetchUrlData * purple_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped); } - if (profile_state == PROFILE_STATE_DEFAULT) { + if (strings && profile_state == PROFILE_STATE_DEFAULT) { #if 0 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as * true, since the Yahoo! ID will always be there */ diff --git a/libpurple/protocols/zephyr/ZReadAscii.c b/libpurple/protocols/zephyr/ZReadAscii.c --- a/libpurple/protocols/zephyr/ZReadAscii.c +++ b/libpurple/protocols/zephyr/ZReadAscii.c @@ -64,7 +64,7 @@ Code_t ZReadAscii32(ptr, len, value_ptr) retval = ZReadAscii(ptr, len, buf, 4); if (retval != ZERR_NONE) return retval; - value |= buf[0] << 24; + value |= (unsigned long)buf[0] << 24; value |= buf[1] << 16; value |= buf[2] << 8; value |= buf[3]; diff --git a/libpurple/protocols/zephyr/zephyr.c b/libpurple/protocols/zephyr/zephyr.c --- a/libpurple/protocols/zephyr/zephyr.c +++ b/libpurple/protocols/zephyr/zephyr.c @@ -697,7 +697,7 @@ static char *zephyr_to_html(const char * gboolean last_had_closer; message += strlen(frames->closer); - if (frames && frames->enclosing) { + if (frames->enclosing) { do { popped = frames; frames = frames->enclosing; @@ -706,7 +706,7 @@ static char *zephyr_to_html(const char * g_string_free(popped->text, TRUE); last_had_closer = popped->has_closer; g_free(popped); - } while (frames && frames->enclosing && !last_had_closer); + } while (frames->enclosing && !last_had_closer); } else { g_string_append_c(frames->text, *message); } diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c --- a/pidgin/gtkprefs.c +++ b/pidgin/gtkprefs.c @@ -729,7 +729,10 @@ theme_install_theme(char *path, struct t g_rename(purple_theme_get_dir(theme), theme_dest); g_free(theme_dest); - g_remove(destdir); + if (g_remove(destdir) != 0) { + purple_debug_error("gtkprefs", + "couldn't remove temp (dest) path\n"); + } g_object_unref(theme); prefs_themes_refresh(); diff --git a/pidgin/plugins/perl/common/GtkIMHtml.xs b/pidgin/plugins/perl/common/GtkIMHtml.xs --- a/pidgin/plugins/perl/common/GtkIMHtml.xs +++ b/pidgin/plugins/perl/common/GtkIMHtml.xs @@ -176,7 +176,7 @@ PPCODE: else t_len = 0; - for (i = 0; i <= t_len; i++) { + for (i = 0; i <= t_len && unused; i++) { STRLEN t_sl; t_GL = g_slist_append(t_GL, SvPV(*av_fetch((AV *)SvRV(unused), i, 0), t_sl)); }