Skip to content

Commit aa0687b

Browse files
committed
Update the printer/class CGI name check.
1 parent 610b03e commit aa0687b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

scheduler/client.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Client routines for the CUPS scheduler.
33
*
4-
* Copyright © 2020-2025 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2007-2021 by Apple Inc.
66
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
77
*
@@ -1142,12 +1142,12 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
11421142
{
11431143
unsigned int i = 0; // Array index
11441144

1145-
for (ptr = con->uri + 9; *ptr && *ptr != '?' && i < sizeof(name);)
1145+
for (ptr = con->uri + 9; *ptr && *ptr != '?' && i < (sizeof(name) - 1);)
11461146
name[i++] = *ptr++;
11471147

11481148
name[i] = '\0';
11491149

1150-
if (!cupsdFindClass(name))
1150+
if ((*ptr && *ptr != '?') || !cupsdFindClass(name))
11511151
{
11521152
if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
11531153
{
@@ -1182,12 +1182,12 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
11821182
{
11831183
unsigned int i = 0; // Array index
11841184

1185-
for (ptr = con->uri + 10; *ptr && *ptr != '?' && i < sizeof(name);)
1185+
for (ptr = con->uri + 10; *ptr && *ptr != '?' && i < (sizeof(name) - 1);)
11861186
name[i++] = *ptr++;
11871187

11881188
name[i] = '\0';
11891189

1190-
if (!cupsdFindPrinter(name))
1190+
if ((*ptr && *ptr != '?') || !cupsdFindPrinter(name))
11911191
{
11921192
if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
11931193
{

0 commit comments

Comments
 (0)