From ca1e12ca501be4054a9a608509ec744a70b32500 Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Mon, 19 Apr 2010 20:43:52 +0200 Subject: added escaping of more XML special chars in notify plugin --- plugins/notify/notify.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'plugins/notify') diff --git a/plugins/notify/notify.c b/plugins/notify/notify.c index 866460be..e6c8e4b1 100644 --- a/plugins/notify/notify.c +++ b/plugins/notify/notify.c @@ -84,6 +84,38 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { dst += 5; src++; } + else if (*src == '<') { + if (end - dst < 4) { + break; + } + strcpy (dst, "<"); + dst += 4; + src++; + } + else if (*src == '>') { + if (end - dst < 4) { + break; + } + strcpy (dst, ">"); + dst += 4; + src++; + } + else if (*src == '\'') { + if (end - dst < 6) { + break; + } + strcpy (dst, "'"); + dst += 6; + src++; + } + else if (*src == '"') { + if (end - dst < 6) { + break; + } + strcpy (dst, """); + dst += 6; + src++; + } else { *dst++ = *src++; } @@ -128,10 +160,8 @@ on_songchanged (DB_event_trackchange_t *ev, uintptr_t data) { int serial; dbus_bool_t retval = dbus_connection_send(conn,msg,&serial); - printf ("retval: %d\n", retval); - //dbus_message_unref (msg); dbus_connection_flush (conn); - + dbus_message_unref (msg); } } return 0; -- cgit v1.2.3