[glib] gdbus-tool: Check return value of strrchr()



commit 88d181ef18b50018d4645870bc6d0a1283177f68
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Aug 29 19:18:45 2012 +0200

    gdbus-tool: Check return value of strrchr()
    
    Fixes a crash when invoking gdbus like:
    
    $ gdbus emit --session -o / -s Foo
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682965

 gio/gdbus-tool.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c
index 10b6a08..a684c7a 100644
--- a/gio/gdbus-tool.c
+++ b/gio/gdbus-tool.c
@@ -625,7 +625,13 @@ handle_emit (gint        *argc,
       g_printerr (_("Error: signal not specified.\n"));
       goto out;
     }
+
   s = strrchr (opt_emit_signal, '.');
+  if (s == NULL)
+    {
+      g_printerr (_("Error: signal must be the fully-qualified name.\n"));
+      goto out;
+    }
   signal_name = g_strdup (s + 1);
   interface_name = g_strndup (opt_emit_signal, s - opt_emit_signal);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]