Skip to content

Commit fad1370

Browse files
committed
Add limits to PWG media dimension scaning.
1 parent 586fbab commit fad1370

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎CHANGES.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ v2.4.21 - YYYY-MM-DD
2121
- Fixed unintended usage of C99 language feature (Issue #1742)
2222
- Fixed regression in mailto notifier address validation (Issue #1744)
2323
- Fixed regression with setting up temporary queues (Issue #1751)
24+
- Fixed a potential integer overflow with `pwgMediaForPWG`.
2425

2526

2627
v2.4.20 - 2026-10-05

‎cups/pwg-media.c‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* PWG media name API implementation for CUPS.
33
*
4-
* Copyright © 2020-2024 by OpenPrinting.
4+
* Copyright © 2020-2026 by OpenPrinting.
55
* Copyright © 2009-2019 by Apple Inc.
66
*
77
* Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -1203,10 +1203,14 @@ pwg_scan_measurement(
12031203
* Scan integer portion...
12041204
*/
12051205

1206-
while (*buf >= '0' && *buf <= '9')
1206+
while (*buf >= '0' && *buf <= '9' && value < 100000)
12071207
value = value * 10 + (*buf++) - '0';
12081208

1209-
if (*buf == '.')
1209+
if (*buf >= '0' && *buf <= '9')
1210+
{
1211+
return (INT_MAX);
1212+
}
1213+
else if (*buf == '.')
12101214
{
12111215
/*
12121216
* Scan fractional portion...

0 commit comments

Comments
 (0)