[Xfce4-commits] r25792 - in xfce4-panel/branches/xfce_4_4: . libxfce4panel panel plugins/clock plugins/launcher

Jasper Huijsmans jasper at xfce.org
Sun Jun 10 11:48:20 CEST 2007


Author: jasper
Date: 2007-06-10 09:48:20 +0000 (Sun, 10 Jun 2007)
New Revision: 25792

Modified:
   xfce4-panel/branches/xfce_4_4/NEWS
   xfce4-panel/branches/xfce_4_4/libxfce4panel/xfce-panel-plugin-iface.c
   xfce4-panel/branches/xfce_4_4/panel/panel-dialogs.c
   xfce4-panel/branches/xfce_4_4/panel/panel.c
   xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c
   xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher-dialog.c
   xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher.c
Log:
Fix possible buffer overflow in launcher tooltips (bug #3324). Use sizeof() to pass buffer sizes for all statically alocated buffers.

Modified: xfce4-panel/branches/xfce_4_4/NEWS
===================================================================
--- xfce4-panel/branches/xfce_4_4/NEWS	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/NEWS	2007-06-10 09:48:20 UTC (rev 25792)
@@ -11,6 +11,7 @@
 - Only update the clock once a minute when seconds are disabled. The
   digital clock is also set in the default layout to minimize the amount
   of screen updates. (Nick)
+- Fix possible buffer overflow in launcher tooltips (bug #3324). (Jasper)
 
 4.4.1
 =====

Modified: xfce4-panel/branches/xfce_4_4/libxfce4panel/xfce-panel-plugin-iface.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/libxfce4panel/xfce-panel-plugin-iface.c	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/libxfce4panel/xfce-panel-plugin-iface.c	2007-06-10 09:48:20 UTC (rev 25792)
@@ -1127,7 +1127,7 @@
     name = xfce_panel_plugin_get_name (plugin);
     id = xfce_panel_plugin_get_id (plugin);
 
-    g_snprintf (path, 255,
+    g_snprintf (path, sizeof(path),
                 "xfce4" G_DIR_SEPARATOR_S
                 "panel" G_DIR_SEPARATOR_S
                 "%s-%s.rc",
@@ -1161,7 +1161,7 @@
     name = xfce_panel_plugin_get_name (plugin);
     id = xfce_panel_plugin_get_id (plugin);
 
-    g_snprintf (path, 255,
+    g_snprintf (path, sizeof(path),
                 "xfce4" G_DIR_SEPARATOR_S
                 "panel" G_DIR_SEPARATOR_S
                 "%s-%s.rc",

Modified: xfce4-panel/branches/xfce_4_4/panel/panel-dialogs.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/panel/panel-dialogs.c	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/panel/panel-dialogs.c	2007-06-10 09:48:20 UTC (rev 25792)
@@ -259,12 +259,12 @@
         
         if (info->comment)
         {
-            g_snprintf (text, 512, "<b>%s</b>\n%s", info->display_name, 
+            g_snprintf (text, sizeof(text), "<b>%s</b>\n%s", info->display_name, 
                                     info->comment);
         }
         else
         {
-            g_snprintf (text, 512, "<b>%s</b>", info->display_name);
+            g_snprintf (text, sizeof(text), "<b>%s</b>", info->display_name);
         }
 
         g_object_set (cell, "markup", text, 
@@ -1276,7 +1276,7 @@
                 gtk_widget_set_size_request (scroll, req.width, -1);
             }
 
-            g_snprintf (markup, 10, "<b>%d</b>", i + 1);
+            g_snprintf (markup, sizeof(markup), "<b>%d</b>", i + 1);
             
             ebox = gtk_event_box_new ();
             style = gtk_widget_get_style (ebox);
@@ -1382,7 +1382,7 @@
     if (G_UNLIKELY (!composite_atom))
     {
         char text[16];
-        g_snprintf (text, 16, "_NET_WM_CM_S%d", 
+        g_snprintf (text, sizeof(text), "_NET_WM_CM_S%d", 
                     GDK_SCREEN_XNUMBER(gdk_screen_get_default()));
         composite_atom = 
             XInternAtom (GDK_DISPLAY (), text, False);
@@ -1453,7 +1453,7 @@
 
     panel_block_autohide (PANEL (g_ptr_array_index (pmd->panels, n)));
 
-    g_snprintf (name, 20, _("Panel %d"), pmd->panels->len);
+    g_snprintf (name, sizeof(name), _("Panel %d"), pmd->panels->len);
 
     gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->panel_selector), name);
 
@@ -1489,7 +1489,7 @@
     {
         char name[20];
 
-        g_snprintf (name, 20, _("Panel %d"), i + 1);
+        g_snprintf (name, sizeof(name), _("Panel %d"), i + 1);
 
         gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->panel_selector), name);
     }
@@ -1514,7 +1514,7 @@
     {
         char name[20];
 
-        g_snprintf (name, 20, _("Panel %d"), i + 1);
+        g_snprintf (name, sizeof(name), _("Panel %d"), i + 1);
 
         gtk_combo_box_append_text (GTK_COMBO_BOX (pmd->panel_selector), name);
     }

Modified: xfce4-panel/branches/xfce_4_4/panel/panel.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/panel/panel.c	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/panel/panel.c	2007-06-10 09:48:20 UTC (rev 25792)
@@ -988,7 +988,7 @@
     static char id[30];
     
     /* unique number: pseudo-random time() + counter */
-    g_snprintf (id, 30, "%ld%d", (glong) time (NULL), counter++);
+    g_snprintf (id, sizeof(id), "%ld%d", (glong) time (NULL), counter++);
     
     return id;
 }

Modified: xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/plugins/clock/clock.c	2007-06-10 09:48:20 UTC (rev 25792)
@@ -173,7 +173,7 @@
 	 * %B  : full month name
 	 * %Y  : four digit year
 	 */
-        strftime(date_s, 255, _("%A %d %B %Y"), tm);
+        strftime(date_s, sizeof(date_s), _("%A %d %B %Y"), tm);
 
         /* Conversion to utf8
          * Patch by Oliver M. Bolzer <oliver at fakeroot.net>

Modified: xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher-dialog.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher-dialog.c	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher-dialog.c	2007-06-10 09:48:20 UTC (rev 25792)
@@ -1183,7 +1183,7 @@
         {
             char last[3];
 
-            g_snprintf (last, 3, "%d", ld->launcher->entries->len - 2);
+            g_snprintf (last, sizeof(last), "%d", ld->launcher->entries->len - 2);
             path = gtk_tree_path_new_from_string (last);
         }
         

Modified: xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher.c
===================================================================
--- xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher.c	2007-06-09 09:37:16 UTC (rev 25791)
+++ xfce4-panel/branches/xfce_4_4/plugins/launcher/launcher.c	2007-06-10 09:48:20 UTC (rev 25792)
@@ -370,7 +370,7 @@
     {
         char first[256];
 
-        g_snprintf (first, 256, _("Could not run \"%s\""), entry->name);
+        g_snprintf (first, sizeof(first), _("Could not run \"%s\""), entry->name);
     
         xfce_message_dialog (NULL, _("Xfce Panel"), 
                              GTK_STOCK_DIALOG_ERROR, first, error->message,
@@ -395,7 +395,7 @@
     {
         char first[256];
         
-        g_snprintf (first, 256, _("Error in command \"%s\""), 
+        g_snprintf (first, sizeof(first), _("Error in command \"%s\""), 
                     entry->real_exec);
     
         xfce_message_dialog (NULL, _("Xfce Panel"), 
@@ -432,7 +432,7 @@
     {
         char first[256];
         
-        g_snprintf (first, 256, _("Could not run \"%s\""), entry->name);
+        g_snprintf (first, sizeof(first), _("Could not run \"%s\""), entry->name);
     
         xfce_message_dialog (NULL, _("Xfce Panel"), 
                              GTK_STOCK_DIALOG_ERROR, first, error->message,
@@ -739,11 +739,11 @@
     if (entry->name || entry->comment)
     {
         if (entry->name && entry->comment)
-            g_snprintf (tip, 521, "%s\n%s", entry->name, entry->comment);
+            g_snprintf (tip, sizeof(tip), "%s\n%s", entry->name, entry->comment);
         else if (entry->name)
-            g_strlcpy (tip, entry->name, 521);
+            g_strlcpy (tip, entry->name, sizeof(tip));
         else
-            g_strlcpy (tip, entry->comment, 521);
+            g_strlcpy (tip, entry->comment, sizeof(tip));
 
         gtk_tooltips_set_tip (launcher->tips, launcher->iconbutton, tip, NULL);
     }
@@ -1029,7 +1029,7 @@
         LauncherEntry *entry;
         char group[10];
         
-        g_snprintf (group, 10, "Entry %d", i);
+        g_snprintf (group, sizeof(group), "Entry %d", i);
         
         if (!xfce_rc_has_group (rc, group))
             break;
@@ -1098,7 +1098,7 @@
     {
         LauncherEntry *entry = g_ptr_array_index (launcher->entries, i);
 
-        g_snprintf (group, 10, "Entry %d", i);
+        g_snprintf (group, sizeof(group), "Entry %d", i);
 
         xfce_rc_set_group (rc, group);
 



More information about the Xfce4-commits mailing list