mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 22:34:37 +00:00
hopefully plugged a possible security hole. Please audit this fix!
--Sven
This commit is contained in:
parent
eec4835461
commit
49bb3594a6
|
@ -1,3 +1,6 @@
|
|||
Tue Nov 23 02:02:30 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/menus.c: fixed a possible buffer overflow
|
||||
|
||||
Mon Nov 22 22:43:59 GMT 1999 Andy Thomas <alt@gimp.org>
|
||||
|
||||
|
|
|
@ -934,16 +934,9 @@ menus_reorder_plugins (void)
|
|||
static gint n_xtns_plugins = (sizeof (xtns_plugins) /
|
||||
sizeof (xtns_plugins[0]));
|
||||
|
||||
static gchar *rotate_plugins[] = { "90 degrees",
|
||||
"180 degrees",
|
||||
"270 degrees" };
|
||||
static gint n_rotate_plugins = (sizeof (rotate_plugins) /
|
||||
sizeof (rotate_plugins[0]));
|
||||
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_item;
|
||||
GList *list;
|
||||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
|
@ -980,32 +973,6 @@ menus_reorder_plugins (void)
|
|||
if (menu_item->submenu)
|
||||
menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu));
|
||||
}
|
||||
|
||||
/* Reorder Rotate plugin menu entries */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transforms/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Layers/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1538,34 +1505,38 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#define MENUPATH_SIZE 384
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar menupath[256];
|
||||
static gchar menupath[MENUPATH_SIZE];
|
||||
gchar *retval;
|
||||
|
||||
menupath[MENUPATH_SIZE - 1] = '\0';
|
||||
|
||||
retval = gettext (path);
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, path);
|
||||
strncat (menupath, "/tearoff1", sizeof (menupath) - strlen (menupath) - 1);
|
||||
strncpy (menupath, path, MENUPATH_SIZE - 1);
|
||||
strncat (menupath, "/tearoff1", MENUPATH_SIZE - 1 - strlen (menupath));
|
||||
retval = gettext (menupath);
|
||||
if (strcmp (menupath, retval))
|
||||
{
|
||||
strcpy (menupath, retval);
|
||||
strncpy (menupath, retval, MENUPATH_SIZE - 1);
|
||||
*(strrchr(menupath, '/')) = '\0';
|
||||
return menupath;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (menupath, "<Image>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Image>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Image>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Image>");
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, "<Toolbox>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Toolbox>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Toolbox>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Toolbox>");
|
||||
}
|
||||
}
|
||||
|
@ -1600,7 +1571,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message(_("tearoff menu not in top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1623,7 +1594,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if (!top)
|
||||
{
|
||||
g_message ("can't unregister tearoff menu top level window");
|
||||
g_message (_("can't unregister tearoff menu top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
53
app/menus.c
53
app/menus.c
|
@ -934,16 +934,9 @@ menus_reorder_plugins (void)
|
|||
static gint n_xtns_plugins = (sizeof (xtns_plugins) /
|
||||
sizeof (xtns_plugins[0]));
|
||||
|
||||
static gchar *rotate_plugins[] = { "90 degrees",
|
||||
"180 degrees",
|
||||
"270 degrees" };
|
||||
static gint n_rotate_plugins = (sizeof (rotate_plugins) /
|
||||
sizeof (rotate_plugins[0]));
|
||||
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_item;
|
||||
GList *list;
|
||||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
|
@ -980,32 +973,6 @@ menus_reorder_plugins (void)
|
|||
if (menu_item->submenu)
|
||||
menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu));
|
||||
}
|
||||
|
||||
/* Reorder Rotate plugin menu entries */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transforms/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Layers/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1538,34 +1505,38 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#define MENUPATH_SIZE 384
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar menupath[256];
|
||||
static gchar menupath[MENUPATH_SIZE];
|
||||
gchar *retval;
|
||||
|
||||
menupath[MENUPATH_SIZE - 1] = '\0';
|
||||
|
||||
retval = gettext (path);
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, path);
|
||||
strncat (menupath, "/tearoff1", sizeof (menupath) - strlen (menupath) - 1);
|
||||
strncpy (menupath, path, MENUPATH_SIZE - 1);
|
||||
strncat (menupath, "/tearoff1", MENUPATH_SIZE - 1 - strlen (menupath));
|
||||
retval = gettext (menupath);
|
||||
if (strcmp (menupath, retval))
|
||||
{
|
||||
strcpy (menupath, retval);
|
||||
strncpy (menupath, retval, MENUPATH_SIZE - 1);
|
||||
*(strrchr(menupath, '/')) = '\0';
|
||||
return menupath;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (menupath, "<Image>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Image>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Image>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Image>");
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, "<Toolbox>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Toolbox>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Toolbox>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Toolbox>");
|
||||
}
|
||||
}
|
||||
|
@ -1600,7 +1571,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message(_("tearoff menu not in top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1623,7 +1594,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if (!top)
|
||||
{
|
||||
g_message ("can't unregister tearoff menu top level window");
|
||||
g_message (_("can't unregister tearoff menu top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -934,16 +934,9 @@ menus_reorder_plugins (void)
|
|||
static gint n_xtns_plugins = (sizeof (xtns_plugins) /
|
||||
sizeof (xtns_plugins[0]));
|
||||
|
||||
static gchar *rotate_plugins[] = { "90 degrees",
|
||||
"180 degrees",
|
||||
"270 degrees" };
|
||||
static gint n_rotate_plugins = (sizeof (rotate_plugins) /
|
||||
sizeof (rotate_plugins[0]));
|
||||
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_item;
|
||||
GList *list;
|
||||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
|
@ -980,32 +973,6 @@ menus_reorder_plugins (void)
|
|||
if (menu_item->submenu)
|
||||
menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu));
|
||||
}
|
||||
|
||||
/* Reorder Rotate plugin menu entries */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transforms/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Layers/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1538,34 +1505,38 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#define MENUPATH_SIZE 384
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar menupath[256];
|
||||
static gchar menupath[MENUPATH_SIZE];
|
||||
gchar *retval;
|
||||
|
||||
menupath[MENUPATH_SIZE - 1] = '\0';
|
||||
|
||||
retval = gettext (path);
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, path);
|
||||
strncat (menupath, "/tearoff1", sizeof (menupath) - strlen (menupath) - 1);
|
||||
strncpy (menupath, path, MENUPATH_SIZE - 1);
|
||||
strncat (menupath, "/tearoff1", MENUPATH_SIZE - 1 - strlen (menupath));
|
||||
retval = gettext (menupath);
|
||||
if (strcmp (menupath, retval))
|
||||
{
|
||||
strcpy (menupath, retval);
|
||||
strncpy (menupath, retval, MENUPATH_SIZE - 1);
|
||||
*(strrchr(menupath, '/')) = '\0';
|
||||
return menupath;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (menupath, "<Image>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Image>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Image>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Image>");
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, "<Toolbox>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Toolbox>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Toolbox>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Toolbox>");
|
||||
}
|
||||
}
|
||||
|
@ -1600,7 +1571,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message(_("tearoff menu not in top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1623,7 +1594,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if (!top)
|
||||
{
|
||||
g_message ("can't unregister tearoff menu top level window");
|
||||
g_message (_("can't unregister tearoff menu top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -934,16 +934,9 @@ menus_reorder_plugins (void)
|
|||
static gint n_xtns_plugins = (sizeof (xtns_plugins) /
|
||||
sizeof (xtns_plugins[0]));
|
||||
|
||||
static gchar *rotate_plugins[] = { "90 degrees",
|
||||
"180 degrees",
|
||||
"270 degrees" };
|
||||
static gint n_rotate_plugins = (sizeof (rotate_plugins) /
|
||||
sizeof (rotate_plugins[0]));
|
||||
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menu_item;
|
||||
GList *list;
|
||||
gchar *path;
|
||||
gint i, pos;
|
||||
|
||||
/* Beautify <Toolbox>/Xtns */
|
||||
|
@ -980,32 +973,6 @@ menus_reorder_plugins (void)
|
|||
if (menu_item->submenu)
|
||||
menus_filters_subdirs_to_top (GTK_MENU (menu_item->submenu));
|
||||
}
|
||||
|
||||
/* Reorder Rotate plugin menu entries */
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Image/Transforms/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
pos = 2;
|
||||
for (i = 0; i < n_rotate_plugins; i++)
|
||||
{
|
||||
path = g_strconcat ("/Layers/Rotate/", rotate_plugins[i], NULL);
|
||||
menu_item = gtk_item_factory_get_widget (image_factory, path);
|
||||
if (menu_item && menu_item->parent)
|
||||
{
|
||||
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, pos);
|
||||
pos++;
|
||||
}
|
||||
g_free (path);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1538,34 +1505,38 @@ menus_init (void)
|
|||
}
|
||||
}
|
||||
|
||||
#define MENUPATH_SIZE 384
|
||||
|
||||
static gchar *
|
||||
menu_translate (const gchar *path,
|
||||
gpointer data)
|
||||
{
|
||||
static gchar menupath[256];
|
||||
static gchar menupath[MENUPATH_SIZE];
|
||||
gchar *retval;
|
||||
|
||||
menupath[MENUPATH_SIZE - 1] = '\0';
|
||||
|
||||
retval = gettext (path);
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, path);
|
||||
strncat (menupath, "/tearoff1", sizeof (menupath) - strlen (menupath) - 1);
|
||||
strncpy (menupath, path, MENUPATH_SIZE - 1);
|
||||
strncat (menupath, "/tearoff1", MENUPATH_SIZE - 1 - strlen (menupath));
|
||||
retval = gettext (menupath);
|
||||
if (strcmp (menupath, retval))
|
||||
{
|
||||
strcpy (menupath, retval);
|
||||
strncpy (menupath, retval, MENUPATH_SIZE - 1);
|
||||
*(strrchr(menupath, '/')) = '\0';
|
||||
return menupath;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy (menupath, "<Image>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Image>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Image>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Image>");
|
||||
if (!strcmp (path, retval))
|
||||
{
|
||||
strcpy (menupath, "<Toolbox>");
|
||||
strncat (menupath, path, sizeof (menupath) - sizeof ("<Toolbox>"));
|
||||
strncat (menupath, path, MENUPATH_SIZE - 1 - sizeof ("<Toolbox>"));
|
||||
retval = dgettext ("gimp-std-plugins", menupath) + strlen ("<Toolbox>");
|
||||
}
|
||||
}
|
||||
|
@ -1600,7 +1571,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
/* This should be a window */
|
||||
if (!GTK_IS_WINDOW (top))
|
||||
{
|
||||
g_message("tearoff menu not in top level window");
|
||||
g_message(_("tearoff menu not in top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1623,7 +1594,7 @@ tearoff_cmd_callback (GtkWidget *widget,
|
|||
|
||||
if (!top)
|
||||
{
|
||||
g_message ("can't unregister tearoff menu top level window");
|
||||
g_message (_("can't unregister tearoff menu top level window"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue