After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 316309 - A small bug in g_key_file_line_is_group in gkeyfile.c
A small bug in g_key_file_line_is_group in gkeyfile.c
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.8.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2005-09-14 13:41 UTC by h_falls
Modified: 2005-09-14 18:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description h_falls 2005-09-14 13:41:52 UTC
Distribution/Version: Debain testing

1. I created a key-value file :
#############
[1]
test=123
[2]
name=hello
#############

2. I use g_key_file_load_from_file() to load this file , but the return value is
FALSE. Then ,I used gdb to see what happened, and found a bug. The below is my
patch :

--- glib-2.8.0-fix/glib/gkeyfile.c      2005-09-14 21:40:10.000000000 +0800
+++ glib-2.8.0-orig/glib/gkeyfile.c     2005-07-02 03:29:33.000000000 +0800
@@ -2989,9 +2989,14 @@

   p = g_utf8_next_char (p);

+  if (!*p)
+    return FALSE;
+
+  p = g_utf8_next_char (p);
+
   /* Group name must be non-empty
    */
-  if (*p == ']' || !*p)
+  if (*p == ']')
     return FALSE;

   while (*p && *p != ']')
Comment 1 Matthias Clasen 2005-09-14 18:13:54 UTC
2005-09-14  Matthias Clasen  <mclasen@redhat.com>

	* tests/keyfile-test.c: Add a test for grup names of length 1.

	* glib/gkeyfile.c (g_key_file_line_is_group): Accept group names
	of length 1.  (#316309)