From: Matthias Clasen Date: Tue, 2 Jan 2007 13:53:15 +0000 (+0000) Subject: Return an error if the uri is bad. (#391370, Maciej Piechotka) X-Git-Tag: GLIB_2_13_0~114 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01c3535fe691ce3561ce276a2a6c217efe7274ff;p=platform%2Fupstream%2Fglib.git Return an error if the uri is bad. (#391370, Maciej Piechotka) 2007-01-02 Matthias Clasen * glib/gbookmarkfile.c (g_bookmark_file_get_app_info): Return an error if the uri is bad. (#391370, Maciej Piechotka) svn path=/trunk/; revision=5192 --- diff --git a/ChangeLog b/ChangeLog index 32c856b..682c271 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-01-02 Matthias Clasen + * glib/gbookmarkfile.c (g_bookmark_file_get_app_info): + Return an error if the uri is bad. (#391370, Maciej Piechotka) + +2007-01-02 Matthias Clasen + * glib/glib.symbols: Guard g_slice_debug_tree_statistics by G_ENABLE_DEBUG. (#390940, Kazuki Iwamoto) diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c index 914da01..ee67699 100644 --- a/glib/gbookmarkfile.c +++ b/glib/gbookmarkfile.c @@ -3306,8 +3306,16 @@ expand_exec_line (const gchar *exec_fmt, case 'f': { gchar *file = g_filename_from_uri (uri, NULL, NULL); - g_string_append (exec, file); - g_free (file); + if (file) + { + g_string_append (exec, file); + g_free (file); + } + else + { + g_string_free (exec, TRUE); + return NULL; + } } break; case '%': @@ -3385,8 +3393,18 @@ g_bookmark_file_get_app_info (GBookmarkFile *bookmark, } if (exec) - *exec = expand_exec_line (ai->exec, uri); - + { + *exec = expand_exec_line (ai->exec, uri); + if (!*exec) + { + g_set_error (error, G_BOOKMARK_FILE_ERROR, + G_BOOKMARK_FILE_ERROR_INVALID_URI, + _("Failed to expand exec line '%s' with URI '%s'"), + ai->exec, uri); + return FALSE; + } + } + if (count) *count = ai->count;