Thu, 15 May 2014 23:02:22 +0200
Coverity: fix null pointer dereferences
--- a/libpurple/http.c Thu May 15 21:11:02 2014 +0200 +++ b/libpurple/http.c Thu May 15 23:02:22 2014 +0200 @@ -1944,6 +1944,7 @@ "Invalid cookie: [%s]\n", cookie); else purple_debug_warning("http", "Invalid cookie."); + continue; } name = g_strndup(cookie, eqsign - cookie); @@ -1955,7 +1956,7 @@ if (semicolon != NULL) { GMatchInfo *match_info; - GRegex *re_expires = g_regex_new( + GRegex *re_expires = g_regex_new( /* XXX: make it static */ "expires=([a-z0-9, :]+)", G_REGEX_OPTIMIZE | G_REGEX_CASELESS, G_REGEX_MATCH_NOTEMPTY, NULL); @@ -2884,7 +2885,7 @@ url->fragment = g_match_info_fetch(match_info, 4); g_match_info_free(match_info); - if (url->protocol[0] == '\0') { + if (g_strcmp0(url->protocol, "") == 0) { g_free(url->protocol); url->protocol = NULL; } else if (url->protocol != NULL) { @@ -2939,7 +2940,7 @@ g_free(url->password); url->password = NULL; } - if (url->host[0] == '\0') { + if (g_strcmp0(url->host, "") == 0) { g_free(url->host); url->host = NULL; } else if (url->host != NULL) {
--- a/libpurple/protocols/gg/utils.c Thu May 15 21:11:02 2014 +0200 +++ b/libpurple/protocols/gg/utils.c Thu May 15 23:02:22 2014 +0200 @@ -111,10 +111,11 @@ gchar * ggp_utf8_strndup(const gchar *str, gsize n) { - size_t raw_len = strlen(str); + size_t raw_len; gchar *end_ptr; if (str == NULL) return NULL; + raw_len = strlen(str); if (raw_len <= n) return g_strdup(str);
--- a/libpurple/protocols/yahoo/yahoo_profile.c Thu May 15 21:11:02 2014 +0200 +++ b/libpurple/protocols/yahoo/yahoo_profile.c Thu May 15 23:02:22 2014 +0200 @@ -1018,7 +1018,7 @@ purple_debug_misc("yahoo", "after utf8 conversion: stripped = (%s)\n", stripped); } - if (strings && profile_state == PROFILE_STATE_DEFAULT) { + if (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 */
--- a/libpurple/request.c Thu May 15 21:11:02 2014 +0200 +++ b/libpurple/request.c Thu May 15 23:02:22 2014 +0200 @@ -959,10 +959,12 @@ while (it != NULL) { g_free(it->data); it = g_list_next(it); /* value */ + if (it == NULL) { + g_warn_if_reached(); + break; + } if (it->data && field->u.choice.data_destroy) field->u.choice.data_destroy(it->data); - if (it == NULL) - break; it = g_list_next(it); /* next label */ } g_list_free(field->u.choice.elements);