Fix bug 7297 - smbd crashes with CUPS printers and no [printers] share defined.
authorJeremy Allison <jra@samba.org>
Fri, 26 Mar 2010 00:09:23 +0000 (17:09 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 26 Mar 2010 00:09:23 +0000 (17:09 -0700)
Ensure we don't dereference an array with an index of -1.

Jeremy.

source3/smbd/service.c

index db54d46a2303ce935da7b32754d67f0f6e459029..36184af75c6174a6d7e119613e479c193ca0daff 100644 (file)
@@ -339,7 +339,7 @@ int find_service(fstring service)
                if ((iPrinterService = lp_servicenumber(PRINTERS_NAME)) < 0) {
                        iPrinterService = load_registry_service(PRINTERS_NAME);
                }
-               if (iPrinterService) {
+               if (iPrinterService >= 0) {
                        DEBUG(3,("checking whether %s is a valid printer name...\n", service));
                        if (pcap_printername_ok(service)) {
                                DEBUG(3,("%s is a valid printer name\n", service));