[Commits] menu.c 1.5.2.47 1.5.2.48 menu.h 1.4.2.27 1.4.2.28
mones at claws-mail.org
mones at claws-mail.org
Sat Oct 6 22:15:33 CEST 2012
Update of /home/claws-mail/claws/src/gtk
In directory srv:/tmp/cvs-serv23066/src/gtk
Modified Files:
Tag: gtk2
menu.c menu.h
Log Message:
2012-10-06 [mones] 3.8.1cvs85
* po/POTFILES.in
Added src/gtk/menu.c
* src/common/defs.h
* src/gtk/menu.c
* src/gtk/menu.h
New function cm_menu_item_new_label_from_url to
avoid crashing on huge URL strings and warn user
about the possible causes
* src/mainwindow.c
Use it to create List menu items safely
Index: menu.h
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/menu.h,v
retrieving revision 1.4.2.27
retrieving revision 1.4.2.28
diff -u -d -r1.4.2.27 -r1.4.2.28
--- menu.h 29 Aug 2012 09:33:02 -0000 1.4.2.27
+++ menu.h 6 Oct 2012 20:15:31 -0000 1.4.2.28
@@ -94,6 +94,8 @@
void cm_menu_set_sensitive_full(GtkUIManager *gui_manager, gchar *menu, gboolean sensitive);
void cm_toggle_menu_set_active_full(GtkUIManager *gui_manager, gchar *menu, gboolean active);
gchar *cm_menu_item_get_shortcut(GtkUIManager *gui_manager, gchar *menu);
+GtkWidget *cm_menu_item_new_label_from_url(gchar *label);
+
#if !GTK_CHECK_VERSION(3, 0, 0)
gint menu_find_option_menu_index(GtkCMOptionMenu *optmenu, gpointer data,
GCompareFunc func);
Index: menu.c
===================================================================
RCS file: /home/claws-mail/claws/src/gtk/menu.c,v
retrieving revision 1.5.2.47
retrieving revision 1.5.2.48
diff -u -d -r1.5.2.47 -r1.5.2.48
--- menu.c 29 Aug 2012 09:33:02 -0000 1.5.2.47
+++ menu.c 6 Oct 2012 20:15:31 -0000 1.5.2.48
@@ -32,6 +32,7 @@
#include "menu.h"
#include "utils.h"
#include "gtkutils.h"
+#include "defs.h"
#ifdef MAEMO
#ifdef CHINOOK
@@ -133,6 +134,23 @@
}
+GtkWidget *cm_menu_item_new_label_from_url(gchar *url)
+{
+ gint len = strlen(url);
+ if (len > MAX_MENU_LABEL_LENGTH) {
+ g_message("Refusing a %d bytes string as menu label\n", len);
+ url[64] = '\0', url[63] = url[62] = url[61] = '.', url[60] = ' ';
+ GtkWidget *newlabel = gtk_menu_item_new_with_label(url);
+ gtk_widget_set_tooltip_markup(GTK_WIDGET(newlabel),
+ _("<span><b>Warning:</b> This URL was too long for displaying and\n"
+ "has been truncated for safety. This message could be\n"
+ "corrupted, malformed or part of some DoS attempt.</span>"));
+ return newlabel;
+ }
+
+ return gtk_menu_item_new_with_label(url);
+}
+
void cm_toggle_menu_set_active_full(GtkUIManager *gui_manager, gchar *menu, gboolean active)
{
GtkWidget *widget;
More information about the Commits
mailing list