Skip to content

Commit e818754

Browse files
committed
Update the printer/class CGI name check.
1 parent 39eb576 commit e818754

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changes in CUPS v2.4.17 (YYYY-MM-DD)
77

88
- The scheduler followed symbolic links when cleaning out its temporary
99
directory (Issue #1448)
10+
- Fixed an issue with the class/printer CGI name checking.
1011
- Fixed notifier logging bug that would result in nul bytes getting into the
1112
log (Issue #1450)
1213
- Fixed possible use-after-free in `cupsdReadClient()` (Issue #1454)

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-2024 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
*
@@ -1163,12 +1163,12 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
11631163
{
11641164
unsigned int i = 0; // Array index
11651165

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

11691169
name[i] = '\0';
11701170

1171-
if (!cupsdFindClass(name))
1171+
if ((*ptr && *ptr != '?') || !cupsdFindClass(name))
11721172
{
11731173
if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
11741174
{
@@ -1203,12 +1203,12 @@ cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */
12031203
{
12041204
unsigned int i = 0; // Array index
12051205

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

12091209
name[i] = '\0';
12101210

1211-
if (!cupsdFindPrinter(name))
1211+
if ((*ptr && *ptr != '?') || !cupsdFindPrinter(name))
12121212
{
12131213
if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE))
12141214
{

0 commit comments

Comments
 (0)