cgi-bin/admin.c: Prevent accessing ppd_name if ppd_name is NULL
The fix provided by Alfonso Gregory, fixes regression after PR
@@ -1218,25 +1218,25 @@ do_am_printer(http_t *http, /* I - HTTP connection */
cgiCopyTemplateLang("printer-modified.tmpl");
}
- else if (strcmp(ppd_name, "everywhere") && !strstr(ppd_name, "driverless"))
+ else if (ppd_name && (strcmp(ppd_name, "everywhere") == 0 || strstr(ppd_name, "driverless")))
{
/*
- * If we don't have an everywhere model, show printer-added
- * template with warning about drivers going away...
+ * Set the printer options...
*/
- cgiStartHTML(title);
- cgiCopyTemplateLang("printer-added.tmpl");
+ cgiSetVariable("OP", "set-printer-options");
+ do_set_options(http, 0);
+ return;
}
else
{
/*
- * Set the printer options...
+ * If we don't have an everywhere model, show printer-added
+ * template with warning about drivers going away...
*/
- cgiSetVariable("OP", "set-printer-options");
- do_set_options(http, 0);
- return;
+ cgiStartHTML(title);
+ cgiCopyTemplateLang("printer-added.tmpl");
}
cgiEndHTML();
