From: Michael R Sweet Date: Wed, 21 Jan 2026 17:12:00 +0000 (-0500) Subject: Update the printer/class CGI name check. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa0687b6f1e39ca00f1b98db32379d655d6e1d59;p=thirdparty%2Fcups.git Update the printer/class CGI name check. --- diff --git a/scheduler/client.c b/scheduler/client.c index 63844d5318..31c376f21d 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,7 +1,7 @@ /* * Client routines for the CUPS scheduler. * - * Copyright © 2020-2025 by OpenPrinting. + * Copyright © 2020-2026 by OpenPrinting. * Copyright © 2007-2021 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -1142,12 +1142,12 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ { unsigned int i = 0; // Array index - for (ptr = con->uri + 9; *ptr && *ptr != '?' && i < sizeof(name);) + for (ptr = con->uri + 9; *ptr && *ptr != '?' && i < (sizeof(name) - 1);) name[i++] = *ptr++; name[i] = '\0'; - if (!cupsdFindClass(name)) + if ((*ptr && *ptr != '?') || !cupsdFindClass(name)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { @@ -1182,12 +1182,12 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ { unsigned int i = 0; // Array index - for (ptr = con->uri + 10; *ptr && *ptr != '?' && i < sizeof(name);) + for (ptr = con->uri + 10; *ptr && *ptr != '?' && i < (sizeof(name) - 1);) name[i++] = *ptr++; name[i] = '\0'; - if (!cupsdFindPrinter(name)) + if ((*ptr && *ptr != '?') || !cupsdFindPrinter(name)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) {