# HG changeset patch # User Stu Tomlinson # Date 1115298568 0 # Node ID 1e6bdc7175e9e88ae374444841b4b82b5757d838 # Parent cfacc0de0d942d8ac81f04ef2725c22a235b33bf [gaim-migrate @ 12619] Bits'n'pieces: Don't allow gaim-remote "clones" to knock gaim out by specifying a big packet length. Correctly bound the point sizes in gtkimhtml & yahoo Fix up some code in MSN that isn't actually being used, just in case someone comes along and submits a patch that would use it. Don't try writing to the server in MSN if you're not actually connected Fix message flags in SILC committer: Tailor Script diff -r cfacc0de0d94 -r 1e6bdc7175e9 plugins/gaim-remote/remote-socket.c --- a/plugins/gaim-remote/remote-socket.c Tue May 03 04:40:53 2005 +0000 +++ b/plugins/gaim-remote/remote-socket.c Thu May 05 13:09:28 2005 +0000 @@ -142,9 +142,9 @@ } if (p->length) { - data = g_malloc(p->length); + data = g_try_malloc(p->length); - if ((read(fd, data, p->length)) != p->length) { + if ((data == NULL) || (read(fd, data, p->length)) != p->length) { g_free(p); return NULL; } diff -r cfacc0de0d94 -r 1e6bdc7175e9 src/gtkimhtml.c --- a/src/gtkimhtml.c Tue May 03 04:40:53 2005 +0000 +++ b/src/gtkimhtml.c Thu May 05 13:09:28 2005 +0000 @@ -96,10 +96,9 @@ static void paste_received_cb (GtkClipboard *clipboard, GtkSelectionData *selection_data, gpointer data); static void paste_plaintext_received_cb (GtkClipboard *clipboard, const gchar *text, gpointer data); -/* POINT_SIZE converts from AIM font sizes to point sizes. It probably should be redone in such a - * way that it base the sizes off the default font size rather than using arbitrary font sizes. */ +/* POINT_SIZE converts from AIM font sizes to a point size scale factor. */ #define MAX_FONT_SIZE 7 -#define POINT_SIZE(x) (options & GTK_IMHTML_USE_POINTSIZE ? x : _point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) +#define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SCALE) - 1]) static gdouble _point_sizes [] = { .69444444, .8333333, 1, 1.2, 1.44, 1.728, 2.0736}; enum { @@ -3453,7 +3452,7 @@ GtkTextAttributes *attr = gtk_text_view_get_default_attributes(GTK_TEXT_VIEW(imhtml)); tag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "size", (gint) (pango_font_description_get_size(attr->font) * - (double) _point_sizes[size-1]), NULL); + (double) POINT_SIZE(size)), NULL); gtk_text_attributes_unref(attr); } diff -r cfacc0de0d94 -r 1e6bdc7175e9 src/protocols/msn/directconn.c --- a/src/protocols/msn/directconn.c Tue May 03 04:40:53 2005 +0000 +++ b/src/protocols/msn/directconn.c Thu May 05 13:09:28 2005 +0000 @@ -315,12 +315,20 @@ return; } - body = g_malloc(body_len); + body = g_try_malloc(body_len); + + if (body != NULL) + { + /* Let's read the data. */ + len = read(directconn->fd, body, body_len); - /* Let's read the data. */ - len = read(directconn->fd, body, body_len); - - gaim_debug_info("msn", "len=%d\n", len); + gaim_debug_info("msn", "len=%d\n", len); + } + else + { + gaim_debug_error("msn", "Failed to allocate memory for read\n"); + len = 0; + } if (len > 0) { diff -r cfacc0de0d94 -r 1e6bdc7175e9 src/protocols/yahoo/util.c --- a/src/protocols/yahoo/util.c Tue May 03 04:40:53 2005 +0000 +++ b/src/protocols/yahoo/util.c Thu May 05 13:09:28 2005 +0000 @@ -349,7 +349,7 @@ /* borrowed from gtkimhtml */ #define MAX_FONT_SIZE 7 -#define POINT_SIZE(x) (_point_sizes [MIN ((x), MAX_FONT_SIZE) - 1]) +#define POINT_SIZE(x) (_point_sizes [MIN ((x > 0 ? x : 1), MAX_FONT_SIZE) - 1]) static gint _point_sizes [] = { 8, 10, 12, 14, 20, 30, 40 }; enum fatype { size, color, face, junk };