Small bugfix for gnome-font-picker


I noticed that an application will crash if it calls
gnome_font_picker_set_font_name() with a string that does not contain a
certain number of dashes ("-"). I looked at the sources of libgnomeui and
found that this is due to a bug in gnome_font_picker_font_extract_attr()
which is quite easy to fix. The small patch is attached.

Thanks for your attention.

Kind regards,
    Thomas Schultz

diff -ur gnome-libs-1.2.3.orig/libgnomeui/gnome-font-picker.c gnome-libs-1.2.3/libgnomeui/gnome-font-picker.c
--- gnome-libs-1.2.3.orig/libgnomeui/gnome-font-picker.c	Mon May 29 16:45:30 2000
+++ gnome-libs-1.2.3/libgnomeui/gnome-font-picker.c	Sat Jul  8 19:39:32 2000
@@ -739,10 +739,10 @@
     gchar *pTmp;
     /* Search paramether */
-    for (pTmp=font_name; i!=0; i--,pTmp++)
+    for (pTmp=font_name; i!=0 && *pTmp!=0; i--,pTmp++)
         pTmp=(gchar *)strchr(pTmp,'-');
-    if (*pTmp!=0) {
+    if (*pTmp!='-' && *pTmp!=0) {
         while (*pTmp!='-' && *pTmp!=0) {
             attr++; pTmp++;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]