wmbiff: Fix segfault when -display or -geometry argument is missing.
authorGabriel VLASIU <gabriel@vlasiu.net>
Thu, 4 Apr 2013 15:43:30 +0000 (4 18:43 +0300)
committerCarlos R. Mafra <crmafra@gmail.com>
Thu, 4 Apr 2013 17:11:13 +0000 (4 18:11 +0100)
wmbiff/wmgeneral/wmgeneral.c

index cb0fd6d..dc06cb6 100644 (file)
@@ -475,11 +475,11 @@ void openXwindow(int argc, const char *argv[],
        }
 
        for (i = 1; argv[i]; i++) {
-               if (!strcmp(argv[i], "-display")) {
+               if (!strcmp(argv[i], "-display") && i < argc - 1) {
                        display_name = argv[i + 1];
                        i++;
                }
-               if (!strcmp(argv[i], "-geometry")) {
+               if (!strcmp(argv[i], "-geometry") && i < argc - 1) {
                        geometry = argv[i + 1];
                        i++;
                }