about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-05-24 22:31:42 +0100
committerJames Booth <boothj5@gmail.com>2014-05-24 22:31:42 +0100
commit60b59d984a4576c780d56e9427248657776fdb01 (patch)
tree859301f2d3bdd5a8bd8c22857d23c35f8c88a840
parentb36fbe413a4a95c1ae75b99ca5d8cbde709bad6f (diff)
downloadprofani-tty-60b59d984a4576c780d56e9427248657776fdb01.tar.gz
Escape strings passed to terminal-notifier
-rw-r--r--src/ui/notifier.c9
1 files 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;