From: Michael R Sweet Date: Thu, 18 Apr 2024 23:06:27 +0000 (-0400) Subject: Increase the mime.types limit to 8192 bytes and document it (Issue #925) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55e951340c14a3035829cfc7e71a0b187c5585bc;p=thirdparty%2Fcups.git Increase the mime.types limit to 8192 bytes and document it (Issue #925) --- diff --git a/CHANGES.md b/CHANGES.md index 28df48d74b..9fabcdfb6e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,8 @@ Changes in CUPS v2.5b1 (TBA) "print-quality" (Issue #734) - Updated `cups_enum_dests()` timeout for listing available IPP printers (Issue #751) +- Updated the `ippeveprinter` program to support the `-f` option with `-a` + (Issue #759) - Updated default destination documentation (Issue #819) - Updated `httpAddrConnect2()` to handle `POLLHUP` together with `POLLIN` or `POLLOUT` (Issue #839) @@ -37,8 +39,7 @@ Changes in CUPS v2.5b1 (TBA) - Updated the "get-printer-attributes-suite.test" test file (Issue #909) - Updated `cupsRasterReadPixels` and `cupsRasterWritePixels` to not try reading or writing if the number of bytes passed is 0 (Issue #914) -- The `ippeveprinter` program now supports the `-f` option with `-a` - (Issue #759) +- Updated and documented the MIME typing buffering limit (Issue #925) - Fixed use-after-free in `cupsdAcceptClient()` when we log warning during error handling (fixes CVE-2023-34241) - Fixed hanging of `lpstat` on Solaris (Issue #156) diff --git a/conf/mime.types b/conf/mime.types index c8603b02ed..62c4889d4a 100644 --- a/conf/mime.types +++ b/conf/mime.types @@ -70,12 +70,12 @@ application/pdf pdf regex(0,^[\n\r]*%PDF) application/postscript ai eps ps string(0,%!) string(0,<04>%!) \ contains(0,128,<1B>%-12345X) + \ - (contains(0,4096,"LANGUAGE=POSTSCRIPT") \ - contains(0,4096,"LANGUAGE = Postscript") \ - contains(0,4096,"LANGUAGE = PostScript") \ - contains(0,4096,"LANGUAGE = POSTSCRIPT") \ - (contains(0,4096,<0a>%!) + \ - !contains(0,4096,"ENTER LANGUAGE"))) + (contains(0,8192,"LANGUAGE=POSTSCRIPT") \ + contains(0,8192,"LANGUAGE = Postscript") \ + contains(0,8192,"LANGUAGE = PostScript") \ + contains(0,8192,"LANGUAGE = POSTSCRIPT") \ + (contains(0,8192,<0a>%!) + \ + !contains(0,8192,"ENTER LANGUAGE"))) ######################################################################## @@ -156,8 +156,8 @@ application/vnd.cups-raster string(0,"RaSt") string(0,"tSaR") \ application/vnd.cups-raw (string(0,<1B>E) + !string(2,<1B>%0B)) \ string(0,<1B>@) \ (contains(0,128,<1B>%-12345X) + \ - (contains(0,4096,"LANGUAGE=PCL") \ - contains(0,4096,"LANGUAGE = PCL"))) + (contains(0,8192,"LANGUAGE=PCL") \ + contains(0,8192,"LANGUAGE = PCL"))) ######################################################################## # diff --git a/doc/help/man-mime.types.html b/doc/help/man-mime.types.html index 55626b2480..bef269887a 100644 --- a/doc/help/man-mime.types.html +++ b/doc/help/man-mime.types.html @@ -39,40 +39,43 @@ See the "TYPE MATCHING AND PRIORITY" section for more information. values inside parenthesis. The following functions are available:

-

match("pattern")
-True if the filename matches the given shell wildcard pattern. +

match("PATTERN")
+True if the filename matches the given shell wildcard PATTERN.

-

ascii(offset,length)
-True if the length bytes starting at offset are valid printable ASCII (CR, NL, TAB, BS, 32-126). +

ascii(OFFSET,LENGTH)
+True if the LENGTH bytes starting at OFFSET are valid printable ASCII (CR, NL, TAB, BS, 32-126). +LENGTH cannot exceed 8192 bytes.

-

printable(offset,length)
-True if the length bytes starting at offset are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). +

printable(OFFSET,LENGTH)
+True if the LENGTH bytes starting at OFFSET are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). +LENGTH cannot exceed 8192 bytes.

-

priority(number)
+

priority(NUMBER)
Specifies the relative priority of this MIME media type. The default priority is 100. Larger values have higher priority while smaller values have lower priority.

-

string(offset,"string")
-True if the bytes starting at offset are identical to string. +

string(OFFSET,"STRING")
+True if the bytes starting at OFFSET are identical to STRING.

-

istring(offset,"string")
-True if the bytes starting at offset match string without respect to case. +

istring(OFFSET,"STRING")
+True if the bytes starting at OFFSET match STRING without respect to case.

-

char(offset,value)
-True if the byte at offset is identical to value. +

char(OFFSET,VALUE)
+True if the byte at OFFSET is identical to VALUE.

-

short(offset,value)
-True if the 16-bit big-endian integer at offset is identical to value. +

short(OFFSET,VALUE)
+True if the 16-bit big-endian integer at OFFSET is identical to VALUE.

-

int(offset,value)
-True if the 32-bit big-endian integer at offset is identical to value. +

int(OFFSET,VALUE)
+True if the 32-bit big-endian integer at OFFSET is identical to VALUE.

-

locale("string")
-True if current locale matches string. +

locale("STRING")
+True if current locale matches STRING.

-

contains(offset,range,"string")
-True if the bytes starting at offset for range bytes contains string. +

contains(OFFSET,LENGTH,"STRING")
+True if the bytes starting at OFFSET for LENGTH bytes contains STRING. +LENGTH cannot exceed 8192 bytes.

String Constants

String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings. diff --git a/man/mime.types.5 b/man/mime.types.5 index 18b6447f6e..c3eda80ed6 100644 --- a/man/mime.types.5 +++ b/man/mime.types.5 @@ -8,7 +8,7 @@ .\" Licensed under Apache License v2.0. See the file "LICENSE" for more .\" information. .\" -.TH mime.types 5 "CUPS" "2021-02-28" "OpenPrinting" +.TH mime.types 5 "CUPS" "2024-04-18" "OpenPrinting" .SH NAME mime.types \- mime type description file for cups .SH DESCRIPTION @@ -40,40 +40,43 @@ Rules take two forms - a filename extension by itself and functions with test values inside parenthesis. The following functions are available: .TP 5 -\fBmatch("\fIpattern\fB")\fR -True if the filename matches the given shell wildcard \fIpattern\fR. +\fBmatch("\fIPATTERN\fB")\fR +True if the filename matches the given shell wildcard \fIPATTERN\fR. .TP 5 -\fBascii(\fIoffset\fB,\fIlength\fB)\fR -True if the \fIlength\fR bytes starting at \fIoffset\fR are valid printable ASCII (CR, NL, TAB, BS, 32-126). +\fBascii(\fIOFFSET\fB,\fILENGTH\fB)\fR +True if the \fILENGTH\fR bytes starting at \fIOFFSET\fR are valid printable ASCII (CR, NL, TAB, BS, 32-126). +\fILENGTH\fR cannot exceed 8192 bytes. .TP 5 -\fBprintable(\fIoffset\fB,\fIlength\fB)\fR -True if the \fIlength\fR bytes starting at \fIoffset\fR are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). +\fBprintable(\fIOFFSET\fB,\fILENGTH\fB)\fR +True if the \fILENGTH\fR bytes starting at \fIOFFSET\fR are printable 8-bit chars (CR, NL, TAB, BS, 32-126, 128-254). +\fILENGTH\fR cannot exceed 8192 bytes. .TP 5 -\fBpriority(\fInumber\fB)\fR +\fBpriority(\fINUMBER\fB)\fR Specifies the relative priority of this MIME media type. The default priority is 100. Larger values have higher priority while smaller values have lower priority. .TP 5 -\fBstring(\fIoffset\fB,"\fIstring\fB")\fR -True if the bytes starting at \fIoffset\fR are identical to \fIstring\fR. +\fBstring(\fIOFFSET\fB,"\fISTRING\fB")\fR +True if the bytes starting at \fIOFFSET\fR are identical to \fISTRING\fR. .TP 5 -\fBistring(\fIoffset\fB,"\fIstring\fB")\fR -True if the bytes starting at \fIoffset\fR match \fIstring\fR without respect to case. +\fBistring(\fIOFFSET\fB,"\fISTRING\fB")\fR +True if the bytes starting at \fIOFFSET\fR match \fISTRING\fR without respect to case. .TP 5 -\fBchar(\fIoffset\fB,\fIvalue\fB)\fR -True if the byte at \fIoffset\fR is identical to \fIvalue\fR. +\fBchar(\fIOFFSET\fB,\fIVALUE\fB)\fR +True if the byte at \fIOFFSET\fR is identical to \fIVALUE\fR. .TP 5 -\fBshort(\fIoffset\fB,\fIvalue\fB)\fR -True if the 16-bit big-endian integer at \fIoffset\fR is identical to \fIvalue\fR. +\fBshort(\fIOFFSET\fB,\fIVALUE\fB)\fR +True if the 16-bit big-endian integer at \fIOFFSET\fR is identical to \fIVALUE\fR. .TP 5 -\fBint(\fIoffset\fB,\fIvalue\fB)\fR -True if the 32-bit big-endian integer at \fIoffset\fR is identical to \fIvalue\fR. +\fBint(\fIOFFSET\fB,\fIVALUE\fB)\fR +True if the 32-bit big-endian integer at \fIOFFSET\fR is identical to \fIVALUE\fR. .TP 5 -\fBlocale("\fIstring\fB")\fR -True if current locale matches \fIstring\fR. +\fBlocale("\fISTRING\fB")\fR +True if current locale matches \fISTRING\fR. .TP 5 -\fBcontains(\fIoffset\fB,\fIrange\fB,"\fIstring\fB")\fR -True if the bytes starting at \fIoffset\fR for \fIrange\fR bytes contains \fIstring\fR. +\fBcontains(\fIOFFSET\fB,\fILENGTH\fB,"\fISTRING\fB")\fR +True if the bytes starting at \fIOFFSET\fR for \fILENGTH\fR bytes contains \fISTRING\fR. +\fILENGTH\fR cannot exceed 8192 bytes. .SS STRING CONSTANTS String constants can be specified inside quotes ("") for strings containing whitespace and angle brackets (<>) for hexadecimal strings. .SS TYPE MATCHING AND PRIORITY diff --git a/scheduler/mime.h b/scheduler/mime.h index 7bb33f3cba..92e563909f 100644 --- a/scheduler/mime.h +++ b/scheduler/mime.h @@ -29,7 +29,7 @@ extern "C" { # define MIME_MAX_TYPE IPP_MAX_NAME // Maximum size of type name # define MIME_MAX_FILTER 256 // Maximum size of filter pathname -# define MIME_MAX_BUFFER 4096 // Maximum size of file buffer +# define MIME_MAX_BUFFER 8192 // Maximum size of file buffer //