From: Zdenek Dohnal Date: Wed, 8 Sep 2021 06:04:13 +0000 (+0200) Subject: cgi-bin/admin.c: Prevent accessing ppd_name if ppd_name is NULL X-Git-Tag: v2.4b1~67^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=92df865260159c141dde7020fa89792575277484;p=thirdparty%2Fcups.git cgi-bin/admin.c: Prevent accessing ppd_name if ppd_name is NULL The fix provided by Alfonso Gregory, fixes regression after PR #218. --- diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index ff944b69a6..294f5cb494 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1218,17 +1218,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ cgiCopyTemplateLang("printer-modified.tmpl"); } - else if (strcmp(ppd_name, "everywhere") && !strstr(ppd_name, "driverless")) - { - /* - * If we don't have an everywhere model, show printer-added - * template with warning about drivers going away... - */ - - cgiStartHTML(title); - cgiCopyTemplateLang("printer-added.tmpl"); - } - else + else if (ppd_name && (strcmp(ppd_name, "everywhere") == 0 || strstr(ppd_name, "driverless"))) { /* * Set the printer options... @@ -1238,6 +1228,16 @@ do_am_printer(http_t *http, /* I - HTTP connection */ do_set_options(http, 0); return; } + else + { + /* + * If we don't have an everywhere model, show printer-added + * template with warning about drivers going away... + */ + + cgiStartHTML(title); + cgiCopyTemplateLang("printer-added.tmpl"); + } cgiEndHTML(); }