Bug is reported on Redhat Bugzilla, id 1278543.
When use the invalid command like:
# cifscreds -u root
Will get a segment fault.
Add a argument check to avoid the segment fault when no sub-command, and
return with stderr 'Need command'.

diff --git a/cifscreds.c b/cifscreds.c
index 5d84c3c..bb63369 100644
--- a/cifscreds.c
+++ b/cifscreds.c
@@ -488,6 +488,13 @@ int main(int argc, char **argv)
        }

        /* find the best fit command */
+
+        /* check if there is sub-command */
+        if (argv[optind] == NULL) {
+                fprintf(stderr, "Need command\n");
+                return EXIT_FAILURE;
+        }
+
        best = NULL;
        n = strnlen(argv[optind], MAX_COMMAND_SIZE);
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to