diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-04-27 20:25:26 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-04-27 20:25:26 +0000 |
commit | 86eb750432f5b39575eaccf0280b5094672556eb (patch) | |
tree | 40d842d20a5d937a656df7f16de3c0ae1405a33d /glib/gbookmarkfile.c | |
parent | 6ea2f9a2c60f8d3e33c4c181ae604fd4ffe33ce4 (diff) | |
download | glib-86eb750432f5b39575eaccf0280b5094672556eb.tar.gz |
Remove some special-casing of empty string which led to dangling pointers.
2006-04-27 Matthias Clasen <mclasen@redhat.com>
* glib/gbookmarkfile.c (g_bookmark_file_set_description)
(g_bookmark_file_set_title, g_bookmark_file_set_icon):
Remove some special-casing of empty string which led to
dangling pointers. (#339337, Morten Welinder)
(expand_exec_line): Don't use printf() needlessly, handle
trailing '%' gracefully. (#339338, Morten Welinder)
(is_element_full): Silence the compiler.
Diffstat (limited to 'glib/gbookmarkfile.c')
-rw-r--r-- | glib/gbookmarkfile.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c index d2cc5201f..0fb425637 100644 --- a/glib/gbookmarkfile.c +++ b/glib/gbookmarkfile.c @@ -1000,9 +1000,8 @@ is_element_full (ParseData *parse_data, const gchar *element, const gchar sep) { - gchar *ns_uri, *ns_name; - gchar *element_name, *resolved; - gchar *p, *s; + gchar *ns_uri, *ns_name, *s, *resolved; + const gchar *p, *element_name; gboolean retval; g_assert (parse_data != NULL); @@ -3282,14 +3281,16 @@ expand_exec_line (const gchar *exec_fmt, ch = *exec_fmt++; switch (ch) { + case '\0': + goto out; case 'u': - g_string_append_printf (exec, "%s", uri); + g_string_append (exec, uri); break; case 'f': { - gchar *file = g_filename_from_uri (uri, NULL, NULL); - g_string_append_printf (exec, "%s", file); - g_free (file); + gchar *file = g_filename_from_uri (uri, NULL, NULL); + g_string_append (exec, file); + g_free (file); } break; case '%': @@ -3299,6 +3300,7 @@ expand_exec_line (const gchar *exec_fmt, } } + out: return g_string_free (exec, FALSE); } |