From 9e5824666934f99d6f43acc9020970bd8279c679 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 14 Mar 2006 17:56:27 +0000 Subject: [PATCH] Don't read past the end of the string. (#334471, Morten Welinder) 2006-03-14 Matthias Clasen * glib/gutils.c (g_parse_debug_string): Don't read past the end of the string. (#334471, Morten Welinder) --- ChangeLog | 6 ++++++ ChangeLog.pre-2-10 | 6 ++++++ ChangeLog.pre-2-12 | 6 ++++++ glib/gutils.c | 14 ++++++-------- tests/testglib.c | 29 ++++++++++++++++++++++++++++- 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c97d3d51f..48a7e3d48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-03-14 Matthias Clasen + * glib/gutils.c (g_parse_debug_string): Don't read past the + end of the string. (#334471, Morten Welinder) + + * tests/testglib.c (test_g_parse_debug_string): Add testss + for g_parse_debug_string. + * glib/goption.c (parse_short_option): Don't create the option_name twice. (#334519, Chris Wilson) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c97d3d51f..48a7e3d48 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,11 @@ 2006-03-14 Matthias Clasen + * glib/gutils.c (g_parse_debug_string): Don't read past the + end of the string. (#334471, Morten Welinder) + + * tests/testglib.c (test_g_parse_debug_string): Add testss + for g_parse_debug_string. + * glib/goption.c (parse_short_option): Don't create the option_name twice. (#334519, Chris Wilson) diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index c97d3d51f..48a7e3d48 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,11 @@ 2006-03-14 Matthias Clasen + * glib/gutils.c (g_parse_debug_string): Don't read past the + end of the string. (#334471, Morten Welinder) + + * tests/testglib.c (test_g_parse_debug_string): Add testss + for g_parse_debug_string. + * glib/goption.c (parse_short_option): Don't create the option_name twice. (#334519, Chris Wilson) diff --git a/glib/gutils.c b/glib/gutils.c index 83ab9b1a5..eba093e13 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -591,23 +591,21 @@ g_parse_debug_string (const gchar *string, { const gchar *p = string; const gchar *q; - gboolean done = FALSE; - while (*p && !done) + while (*p) { q = strchr (p, ':'); if (!q) - { - q = p + strlen(p); - done = TRUE; - } + q = p + strlen(p); - for (i=0; i