File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11Changes in libcups
22==================
33
4+ v3.0.3 - YYYY-MM-DD
5+ -------------------
6+
7+ - Fixed a potential buffer overflow in ` cupsFormEncode ` .
8+
9+
410v3.0.2 - 2026-06-05
511-------------------
612
Original file line number Diff line number Diff line change 11//
22// Form API functions for CUPS.
33//
4- // Copyright © 2023-2025 by OpenPrinting.
4+ // Copyright © 2023-2026 by OpenPrinting.
55// Copyright © 2017-2022 by Michael R Sweet
66//
77// Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -297,12 +297,18 @@ encode_string(const char *s, // I - String to encode
297297 if (* s == ' ' )
298298 {
299299 // Space is encoded as '+'
300- * bufptr ++ = '+' ;
300+ if (bufptr < bufend )
301+ * bufptr ++ = '+' ;
302+ else
303+ bufptr ++ ;
301304 }
302305 else if (* s == '\n' )
303306 {
304307 // Newline is encoded as percent-encoded CR & LF
305- * bufptr ++ = '%' ;
308+ if (bufptr < bufend )
309+ * bufptr ++ = '%' ;
310+ else
311+ bufptr ++ ;
306312 if (bufptr < bufend )
307313 * bufptr ++ = '0' ;
308314 else
@@ -327,7 +333,10 @@ encode_string(const char *s, // I - String to encode
327333 else if (!isalnum (* s & 255 ))
328334 {
329335 // Characters other than letters and numbers get percent-encoded
330- * bufptr ++ = '%' ;
336+ if (bufptr < bufend )
337+ * bufptr ++ = '%' ;
338+ else
339+ bufptr ++ ;
331340 if (bufptr < bufend )
332341 * bufptr ++ = hex [(* s >> 4 ) & 15 ];
333342 else
You can’t perform that action at this time.
0 commit comments