From: Nico Golde Date: Sun, 13 Jul 2008 13:29:50 +0000 (+0200) Subject: Properly escape strings before writing XML. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=b6c501cb7cd148fb9beccadcdfc092d1f7d167a4;p=chaz%2Fopenbox Properly escape strings before writing XML. --- diff --git a/openbox/session.c b/openbox/session.c index 77dc5de0..811592ec 100644 --- a/openbox/session.c +++ b/openbox/session.c @@ -486,10 +486,14 @@ static gboolean session_save_to_file(const ObSMSaveData *savedata) if (screen_desktop_names) { gint i; + gchar *t; fprintf(f, "\n"); - for (i = 0; screen_desktop_names[i]; ++i) - fprintf(f, " %s\n", screen_desktop_names[i]); + for (i = 0; screen_desktop_names[i]; ++i){ + t = g_markup_escape_text(screen_desktop_names[i], -1); + fprintf(f, " %s\n", t); + g_free(t); + } fprintf(f, "\n"); } @@ -544,8 +548,11 @@ static gboolean session_save_to_file(const ObSMSaveData *savedata) if (c->sm_client_id) fprintf(f, "\n", c->sm_client_id); - else - fprintf(f, "\n", c->wm_command); + else { + t = g_markup_escape_text(c->wm_command, -1); + fprintf(f, "\n", t); + g_free(t); + } t = g_markup_escape_text(c->name, -1); fprintf(f, "\t%s\n", t);