Skip to content

Commit 44ac013

Browse files
committed
Fix parsing bug in cgiCheckVariables.
1 parent 3d748da commit 44ac013

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

cgi-bin/var.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* CGI form variable and array functions for CUPS.
33
*
4-
* Copyright © 2020-2025 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2007-2019 by Apple Inc.
66
* Copyright © 1997-2005 by Easy Software Products.
77
*
@@ -88,8 +88,11 @@ cgiCheckVariables(const char *names) /* I - Variables to look for */
8888
while (*names == ' ' || *names == ',')
8989
names ++;
9090

91-
for (s = name; *names != '\0' && *names != ' ' && *names != ','; s ++, names ++)
92-
*s = *names;
91+
for (s = name; *names != '\0' && *names != ' ' && *names != ','; names ++)
92+
{
93+
if (s < (name + sizeof(name) - 1))
94+
*s++ = *names;
95+
}
9396

9497
*s = 0;
9598
if (name[0] == '\0')

0 commit comments

Comments
 (0)