s3:printing: Do not segfault in vlp if no command has been specified
authorAndreas Schneider <asn@samba.org>
Wed, 12 Jul 2017 11:07:08 +0000 (13:07 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 25 Jul 2017 07:14:19 +0000 (09:14 +0200)
We should just print the usage() and return

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/printing/tests/vlp.c

index 86aba98380ffbd3cf50d2de8b90b3b20919f54bb..54a62f1c19d1d6b4a7f1e4f799b5a8f63373644a 100644 (file)
@@ -405,6 +405,10 @@ int main(int argc, char **argv)
        chmod(printdb_path, 0666);
 
        /* Do commands */
+       if (argc < 3) {
+               usage();
+               return 1;
+       }
 
        if (strcmp(argv[2], "lpq") == 0) {
                return lpq_command(argc - 2, &argv[2]);