[mutter/wayland] weston-launch: Don't segfault if passed no arguments



commit 7bd4e6ecb0a902ec38abc776e857a5559d636d56
Author: Colin Walters <walters verbum org>
Date:   Fri Aug 30 08:26:31 2013 -0400

    weston-launch: Don't segfault if passed no arguments
    
    Probably not exploitable since I think Linux always puts NULL there,
    but let's actually check.

 src/wayland/weston-launch.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/weston-launch.c b/src/wayland/weston-launch.c
index 71c7530..e848d84 100644
--- a/src/wayland/weston-launch.c
+++ b/src/wayland/weston-launch.c
@@ -737,6 +737,8 @@ main(int argc, char *argv[])
        if ((argc - optind) > (MAX_ARGV_SIZE - 6))
                error(1, E2BIG, "Too many arguments to pass to weston");
 
+       if (optind >= argc)
+               error(1, 0, "Expected program argument");
        if (strcmp (argv[optind], "mutter-wayland") &&
            strcmp (argv[optind], "gnome-shell-wayland"))
          error(1, 0, "mutter-launch can only be used to launch mutter or gnome-shell");


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