/pidgin/main: 31a8779e91d4: Merge release-2.x.y
Tomasz Wasilczyk
twasilczyk at pidgin.im
Wed May 7 05:07:57 EDT 2014
Changeset: 31a8779e91d44d4a634283d03cee9b64cf126f9e
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-05-07 11:07 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/31a8779e91d4
Description:
Merge release-2.x.y
diffstat:
finch/gntnotify.c | 2 +
finch/gntprefs.c | 6 ++-
finch/gntrequest.c | 7 +++-
finch/libfinch.c | 5 +-
finch/libgnt/gntbox.c | 4 +-
finch/libgnt/gntcheckbox.c | 2 +-
finch/libgnt/gntcombobox.c | 2 +-
finch/libgnt/gntentry.c | 2 +-
finch/libgnt/gnttextview.c | 2 +-
finch/libgnt/gntwidget.c | 2 +
finch/libgnt/gntwm.c | 4 +-
finch/libgnt/gntws.c | 2 +
finch/libgnt/wms/irssi.c | 2 +-
libpurple/dnsquery.c | 4 +-
libpurple/dnssrv.c | 6 +++
libpurple/log.c | 38 +++++++++++++++-------
libpurple/mediamanager.c | 6 +++-
libpurple/network.c | 5 +-
libpurple/plugins/log_reader.c | 28 +++++++++++-----
libpurple/plugins/perl/common/Cipher.xs | 6 +++
libpurple/plugins/perl/perl-common.c | 3 +-
libpurple/protocols/bonjour/bonjour_ft.c | 3 +-
libpurple/protocols/bonjour/jabber.c | 28 ++++++++++++----
libpurple/protocols/irc/dcc_send.c | 3 +-
libpurple/protocols/jabber/chat.c | 3 +-
libpurple/protocols/jabber/jabber.c | 2 +
libpurple/protocols/jabber/si.c | 3 +-
libpurple/protocols/msn/contact.c | 1 +
libpurple/protocols/msn/msnutils.c | 2 +-
libpurple/protocols/oscar/family_icbm.c | 8 ++++-
libpurple/protocols/oscar/family_oservice.c | 9 ++++-
libpurple/protocols/oscar/peer.c | 3 +-
libpurple/protocols/oscar/userinfo.c | 5 +-
libpurple/protocols/silc/buddy.c | 12 +-----
libpurple/protocols/silc/util.c | 6 +-
libpurple/protocols/simple/simple.c | 10 ++++-
libpurple/protocols/yahoo/libymsg.c | 4 +-
libpurple/protocols/yahoo/util.c | 17 ++++++++-
libpurple/protocols/zephyr/ZOpenPort.c | 14 +++++---
libpurple/protocols/zephyr/ZReadAscii.c | 7 +++-
libpurple/protocols/zephyr/ZRetSubs.c | 1 +
libpurple/protocols/zephyr/Zinternal.c | 4 +-
libpurple/protocols/zephyr/zephyr.c | 48 ++++++++++++++++------------
libpurple/proxy.c | 15 ++++++---
libpurple/stun.c | 9 ++++-
libpurple/util.c | 39 ++++++++++++-----------
libpurple/xfer.c | 7 +++-
libpurple/xmlnode.c | 1 +
pidgin/gtkblist.c | 3 +
pidgin/gtknotify.c | 5 +-
pidgin/gtkprefs.c | 6 +-
pidgin/gtksession.c | 3 +-
pidgin/gtkstatusbox.c | 4 ++
pidgin/libpidgin.c | 5 +-
pidgin/plugins/spellchk.c | 5 +-
55 files changed, 288 insertions(+), 145 deletions(-)
diffs (truncated from 1371 to 300 lines):
diff --git a/finch/gntnotify.c b/finch/gntnotify.c
--- a/finch/gntnotify.c
+++ b/finch/gntnotify.c
@@ -59,8 +59,10 @@ finch_notify_common(PurpleNotifyType nty
{
case PURPLE_NOTIFY_MSG_ERROR:
sf |= GNT_TEXT_FLAG_BOLD;
+ /* fall through */
case PURPLE_NOTIFY_MSG_WARNING:
pf |= GNT_TEXT_FLAG_UNDERLINE;
+ /* fall through */
case PURPLE_NOTIFY_MSG_INFO:
pf |= GNT_TEXT_FLAG_BOLD;
break;
diff --git a/finch/gntprefs.c b/finch/gntprefs.c
--- a/finch/gntprefs.c
+++ b/finch/gntprefs.c
@@ -143,12 +143,14 @@ get_pref_field(Prefs *prefs)
switch (prefs->type)
{
case PURPLE_PREF_BOOLEAN:
- sscanf(iter->data, "%d", &idata);
+ if (sscanf(iter->data, "%d", &idata) != 1)
+ idata = FALSE;
if (purple_prefs_get_bool(prefs->pref) == idata)
select = TRUE;
break;
case PURPLE_PREF_INT:
- sscanf(iter->data, "%d", &idata);
+ if (sscanf(iter->data, "%d", &idata) != 1)
+ idata = 0;
if (purple_prefs_get_int(prefs->pref) == idata)
select = TRUE;
break;
diff --git a/finch/gntrequest.c b/finch/gntrequest.c
--- a/finch/gntrequest.c
+++ b/finch/gntrequest.c
@@ -916,8 +916,11 @@ void finch_request_save_in_prefs(gpointe
case PURPLE_PREF_INT:
{
long int tmp = GPOINTER_TO_INT(val);
- if (type == PURPLE_REQUEST_FIELD_LIST) /* Lists always return string */
- sscanf(val, "%ld", &tmp);
+ if (type == PURPLE_REQUEST_FIELD_LIST) {
+ /* Lists always return string */
+ if (sscanf(val, "%ld", &tmp) != 1)
+ tmp = 0;
+ }
purple_prefs_set_int(id, (gint)tmp);
break;
}
diff --git a/finch/libfinch.c b/finch/libfinch.c
--- a/finch/libfinch.c
+++ b/finch/libfinch.c
@@ -268,7 +268,6 @@ init_libpurple(int argc, char **argv)
gboolean opt_version = FALSE;
char *opt_config_dir_arg = NULL;
gboolean debug_enabled = FALSE;
- GStatBuf st;
struct option long_options[] = {
{"config", required_argument, NULL, 'c'},
@@ -360,8 +359,8 @@ init_libpurple(int argc, char **argv)
purple_idle_set_ui_ops(finch_idle_get_ui_ops());
path = g_build_filename(purple_user_dir(), "plugins", NULL);
- if (!g_stat(path, &st))
- g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR);
+ if (g_mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR) != 0 && errno != EEXIST)
+ fprintf(stderr, "Couldn't create plugins dir\n");
purple_plugins_add_search_path(path);
g_free(path);
diff --git a/finch/libgnt/gntbox.c b/finch/libgnt/gntbox.c
--- a/finch/libgnt/gntbox.c
+++ b/finch/libgnt/gntbox.c
@@ -232,8 +232,8 @@ gnt_box_size_request(GntWidget *widget)
h = maxh;
}
- gnt_widget_confirm_size(wid, w, h);
- gnt_widget_set_size(wid, w, h);
+ if (gnt_widget_confirm_size(wid, w, h))
+ gnt_widget_set_size(wid, w, h);
}
reposition_children(widget);
diff --git a/finch/libgnt/gntcheckbox.c b/finch/libgnt/gntcheckbox.c
--- a/finch/libgnt/gntcheckbox.c
+++ b/finch/libgnt/gntcheckbox.c
@@ -52,7 +52,7 @@ gnt_check_box_draw(GntWidget *widget)
wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
mvwaddstr(widget->window, 0, 4, C_(GNT_BUTTON(cb)->priv->text));
- wmove(widget->window, 0, 1);
+ (void)wmove(widget->window, 0, 1);
GNTDEBUG;
}
diff --git a/finch/libgnt/gntcombobox.c b/finch/libgnt/gntcombobox.c
--- a/finch/libgnt/gntcombobox.c
+++ b/finch/libgnt/gntcombobox.c
@@ -96,7 +96,7 @@ gnt_combo_box_draw(GntWidget *widget)
whline(widget->window, ' ' | gnt_color_pair(type), widget->priv.width - 4 - len);
mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL));
mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | gnt_color_pair(GNT_COLOR_NORMAL));
- wmove(widget->window, 1, 1);
+ (void)wmove(widget->window, 1, 1);
g_free(text);
GNTDEBUG;
diff --git a/finch/libgnt/gntentry.c b/finch/libgnt/gntentry.c
--- a/finch/libgnt/gntentry.c
+++ b/finch/libgnt/gntentry.c
@@ -299,7 +299,7 @@ gnt_entry_draw(GntWidget *widget)
curpos = gnt_util_onscreen_width(entry->scroll, entry->cursor);
if (focus)
mvwchgat(widget->window, 0, curpos, 1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
- wmove(widget->window, 0, curpos);
+ (void)wmove(widget->window, 0, curpos);
GNTDEBUG;
}
diff --git a/finch/libgnt/gnttextview.c b/finch/libgnt/gnttextview.c
--- a/finch/libgnt/gnttextview.c
+++ b/finch/libgnt/gnttextview.c
@@ -106,7 +106,7 @@ gnt_text_view_draw(GntWidget *widget)
GList *iter;
GntTextLine *line = lines->data;
- wmove(widget->window, widget->priv.height - 1 - i - comp, 0);
+ (void)wmove(widget->window, widget->priv.height - 1 - i - comp, 0);
for (iter = line->segments; iter; iter = iter->next)
{
diff --git a/finch/libgnt/gntwidget.c b/finch/libgnt/gntwidget.c
--- a/finch/libgnt/gntwidget.c
+++ b/finch/libgnt/gntwidget.c
@@ -318,6 +318,8 @@ gnt_widget_destroy(GntWidget *obj)
void
gnt_widget_show(GntWidget *widget)
{
+ g_return_if_fail(widget != NULL);
+
gnt_widget_draw(widget);
gnt_screen_occupy(widget);
}
diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -141,7 +141,7 @@ gnt_wm_copy_win(GntWidget *widget, GntNo
int curx = active->priv.x + getcurx(active->window);
int cury = active->priv.y + getcury(active->window);
if (wmove(node->window, cury - widget->priv.y, curx - widget->priv.x) != OK)
- wmove(node->window, 0, 0);
+ (void)wmove(node->window, 0, 0);
}
}
}
@@ -1817,6 +1817,8 @@ gnt_wm_new_window_real(GntWM *wm, GntWid
maxx = getmaxx(stdscr);
maxy = getmaxy(stdscr) - 1; /* room for the taskbar */
+ maxx = MAX(0, maxx);
+ maxy = MAX(0, maxy);
x = MAX(0, x);
y = MAX(0, y);
diff --git a/finch/libgnt/gntws.c b/finch/libgnt/gntws.c
--- a/finch/libgnt/gntws.c
+++ b/finch/libgnt/gntws.c
@@ -62,6 +62,8 @@ gnt_ws_draw_taskbar(GntWS *ws, gboolean
if (gnt_is_refugee())
return;
+ g_return_if_fail(ws != NULL);
+
if (taskbar == NULL) {
taskbar = newwin(1, getmaxx(stdscr), getmaxy(stdscr) - 1, 0);
} else if (reposition) {
diff --git a/finch/libgnt/wms/irssi.c b/finch/libgnt/wms/irssi.c
--- a/finch/libgnt/wms/irssi.c
+++ b/finch/libgnt/wms/irssi.c
@@ -218,7 +218,7 @@ update_conv_window_title(GntNode *node)
getyx(node->window, y, x);
wbkgdset(node->window, '\0' | COLOR_PAIR(gnt_widget_has_focus(node->me) ? GNT_COLOR_TITLE : GNT_COLOR_TITLE_D));
mvwaddstr(node->window, 0, 0, title);
- wmove(node->window, y, x);
+ (void)wmove(node->window, y, x);
if (!gnt_is_refugee()) {
update_panels();
doupdate();
diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c
--- a/libpurple/dnsquery.c
+++ b/libpurple/dnsquery.c
@@ -33,6 +33,8 @@
#include <resolv.h>
#endif
+#define MAX_ADDR_RESPONSE_LEN 1048576
+
#if (defined(__APPLE__) || defined (__unix__)) && !defined(__osf__)
#define PURPLE_DNSQUERY_USE_FORK
#endif
@@ -664,7 +666,7 @@ host_resolved(gpointer data, gint source
/* Success! */
while (rc > 0) {
rc = read(query_data->resolver->fd_out, &addrlen, sizeof(addrlen));
- if (rc > 0 && addrlen > 0) {
+ if (rc > 0 && addrlen > 0 && addrlen < MAX_ADDR_RESPONSE_LEN) {
addr = g_malloc(addrlen);
rc = read(query_data->resolver->fd_out, addr, addrlen);
hosts = g_slist_append(hosts, GINT_TO_POINTER(addrlen));
diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c
--- a/libpurple/dnssrv.c
+++ b/libpurple/dnssrv.c
@@ -45,6 +45,8 @@
#define T_TXT PurpleDnsTypeTxt
#endif
+#define MAX_ADDR_RESPONSE_LEN 1048576
+
#include "debug.h"
#include "dnssrv.h"
#include "eventloop.h"
@@ -492,6 +494,10 @@ resolved(gpointer data, gint source, Pur
if (read(source, &type, sizeof(type)) == sizeof(type)) {
if (read(source, &size, sizeof(size)) == sizeof(size)) {
+ if (size < -1 || size > MAX_ADDR_RESPONSE_LEN) {
+ purple_debug_warning("dnssrv", "res_query returned invalid number\n");
+ size = 0;
+ }
if (size == -1 || size == 0) {
if (size == -1) {
purple_debug_warning("dnssrv", "res_query returned an error\n");
diff --git a/libpurple/log.c b/libpurple/log.c
--- a/libpurple/log.c
+++ b/libpurple/log.c
@@ -1735,8 +1735,15 @@ static GList *old_logger_list(PurpleLogT
/* Change the .log extension to .idx */
strcpy(pathstr + strlen(pathstr) - 3, "idx");
- if (g_stat(pathstr, &st) == 0)
- {
+ index_fd = g_open(pathstr, 0, O_RDONLY);
+ if (index_fd != -1) {
+ if (fstat(index_fd, &st) != 0) {
+ close(index_fd);
+ index_fd = -1;
+ }
+ }
+
+ if (index_fd != -1) {
if (st.st_mtime < log_last_modified)
{
purple_debug_warning("log", "Index \"%s\" exists, but is older than the log.\n", pathstr);
@@ -1744,15 +1751,12 @@ static GList *old_logger_list(PurpleLogT
else
{
/* The index file exists and is at least as new as the log, so open it. */
- if (!(index = g_fopen(pathstr, "rb")))
- {
+ if (!(index = fdopen(index_fd, "rb"))) {
purple_debug_error("log", "Failed to open index file \"%s\" for reading: %s\n",
pathstr, g_strerror(errno));
/* Fall through so that we'll parse the log file. */
- }
- else
- {
+ } else {
purple_debug_info("log", "Using index: %s\n", pathstr);
g_free(pathstr);
while (fgets(buf, BUF_LONG, index))
@@ -1868,8 +1872,12 @@ static GList *old_logger_list(PurpleLogT
g_snprintf(convostart, length, "%s", temp);
memset(&tm, 0, sizeof(tm));
- sscanf(convostart, "%*s %3s %d %d:%d:%d %d",
- month, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &tm.tm_year);
+ if (sscanf(convostart, "%*s %3s %d %d:%d:%d %d", month,
+ &tm.tm_mday, &tm.tm_hour, &tm.tm_min,
+ &tm.tm_sec, &tm.tm_year) != 6)
+ {
+ purple_debug_warning("log", "invalid date format\n");
+ }
/* Ugly hack, in case current locale is not English */
if (purple_strequal(month, "Jan")) {
tm.tm_mon= 0;
@@ -1973,9 +1981,15 @@ static char * old_logger_read (PurpleLog
struct old_logger_data *data = log->logger_data;
const char *path = purple_stringref_value(data->pathref);
FILE *file = g_fopen(path, "rb");
- char *read = g_malloc(data->length + 1);
- fseek(file, data->offset, SEEK_SET);
- result = fread(read, data->length, 1, file);
+ char *read;
+
+ g_return_val_if_fail(file, g_strdup(""));
More information about the Commits
mailing list