From 60b59d984a4576c780d56e9427248657776fdb01 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sat, 24 May 2014 22:31:42 +0100 Subject: [PATCH] Escape strings passed to terminal-notifier --- src/ui/notifier.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/notifier.c b/src/ui/notifier.c index 778487e2..04eb0130 100644 --- a/src/ui/notifier.c +++ b/src/ui/notifier.c @@ -212,9 +212,12 @@ _notify(const char * const message, int timeout, Shell_NotifyIcon(NIM_MODIFY, &nid); #endif #ifdef HAVE_OSXNOTIFY - GString *notify_command = g_string_new("terminal-notifier -title 'Profanity' -message '"); - g_string_append(notify_command, message); - g_string_append(notify_command, "'"); + GString *notify_command = g_string_new("terminal-notifier -title \"Profanity\" -message \""); + + char *escaped = str_replace(message, "\"", "\\\""); + g_string_append(notify_command, escaped); + g_string_append(notify_command, "\""); + free(escaped); char *term_name = getenv("TERM_PROGRAM"); char *app_id = NULL;