GNOME Bugzilla – Bug 316309
A small bug in g_key_file_line_is_group in gkeyfile.c
Last modified: 2005-09-14 18:13:54 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 != ']')
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)