Skip to content

Commit f6752d8

Browse files
authored
Merge pull request #1511 from zdohnal/nice-values
scheduler: Sanitize values for FilterNice directive
2 parents 456b4f4 + 13592ce commit f6752d8

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

CHANGES.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ v2.5b1 - YYYY-MM-DD
161161
(Issue #1201)
162162
- Fixed job cleanup after daemon restart (Issue #1315)
163163
- Fixed unreachable block in IPP backend (Issue #1351)
164-
- Fixed memory leak in _cupsConvertOptions (Issue #1354)
164+
- Fixed memory leak in `_cupsConvertOptions()` (Issue #1354)
165165
- Fixed missing write check in `cupsFileOpen/Fd` (Issue #1360)
166166
- Fixed error recovery when scanning for PPDs in `cups-driverd` (Issue #1416)
167+
- Fixed allowed values for directive `FilterNice`
167168
- Removed hash support for SHA2-512-224 and SHA2-512-256.
168169
- Removed `mantohtml` script for generating html pages (use
169170
`https://www.msweet.org/mantohtml/`)

scheduler/conf.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static const cupsd_var_t cupsd_vars[] =
8181
{ "DNSSDHostName", &DNSSDHostName, CUPSD_VARTYPE_STRING },
8282
{ "ErrorPolicy", &ErrorPolicy, CUPSD_VARTYPE_STRING },
8383
{ "FilterLimit", &FilterLimit, CUPSD_VARTYPE_INTEGER },
84-
{ "FilterNice", &FilterNice, CUPSD_VARTYPE_INTEGER },
8584
#ifdef HAVE_GSSAPI
8685
{ "GSSServiceName", &GSSServiceName, CUPSD_VARTYPE_STRING },
8786
#endif /* HAVE_GSSAPI */
@@ -3494,6 +3493,28 @@ read_cupsd_conf(cups_file_t *fp) /* I - File to read from */
34943493
break;
34953494
}
34963495
}
3496+
else if (!_cups_strcasecmp(line, "FilterNice") && value)
3497+
{
3498+
/*
3499+
* FilterNice [0-19]
3500+
*/
3501+
3502+
char *end; /* Remaining string if any*/
3503+
3504+
long n = strtol(value, &end, 10);
3505+
3506+
if ((end && *end) || n < 0 || n > 19)
3507+
{
3508+
cupsdLogMessage(CUPSD_LOG_WARN, "The directive FilterNice accepts values 0 to 19.");
3509+
3510+
if (FatalErrors & CUPSD_FATAL_CONFIG)
3511+
return (0);
3512+
else
3513+
continue;
3514+
}
3515+
3516+
FilterNice = n;
3517+
}
34973518
else if (!_cups_strcasecmp(line, "AccessLog") ||
34983519
!_cups_strcasecmp(line, "CacheDir") ||
34993520
!_cups_strcasecmp(line, "ConfigFilePerm") ||

0 commit comments

Comments
 (0)