]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The cups-lpd program did not catch all legacy usage of ISO-8859-1 (Issue #4899)
authorMichael Sweet <michael.r.sweet@gmail.com>
Thu, 13 Oct 2016 13:58:42 +0000 (09:58 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Thu, 13 Oct 2016 13:58:42 +0000 (09:58 -0400)
CHANGES.txt
doc/help/man-backend.html
scheduler/cups-lpd.c

index 1b3dcdee1418e048750ed0757a4846a3645e8ee7..53a4640b7a72d689610457879df19c81cf483e04 100644 (file)
@@ -1,6 +1,12 @@
-CHANGES.txt - 2.2.1 - 2016-10-03
+CHANGES.txt - 2.2.2 - 2016-10-13
 --------------------------------
 
+CHANGES IN CUPS V2.2.2
+
+       - The cups-lpd program did not catch all legacy usage of ISO-8859-1
+          (Issue #4899)
+
+
 CHANGES IN CUPS V2.2.1
 
        - Added "CreateSelfSignedCerts" directive for cups-files.conf to
index 156717b4604637cb77f1d9f6df844e345084844a..1a2197285700fc1e5e99d5ac648099fd81f7ed5a 100644 (file)
@@ -61,7 +61,7 @@ function may be used to retrieve the correct device URI.
 <p>Backends are responsible for reading side-channel requests using the
 <b>cupsSideChannelRead</b>()
 function and responding with the
-<b>cupsSideChannelWrite()</b>
+<b>cupsSideChannelWrite</b>()
 function. The
 <b>CUPS_SC_FD</b>
 constant defines the file descriptor that should be monitored for incoming requests.
@@ -147,7 +147,7 @@ CUPS backends can expect the following environment variable:
 <h2 class="title"><a name="FILES">Files</a></h2>
 <i>/etc/cups/cups-files.conf</i>
 <h2 class="title"><a name="NOTES">Notes</a></h2>
-CUPS backends are not generally design to be run directly by the user. Aside from the device URI issue (
+CUPS backends are not generally designed to be run directly by the user. Aside from the device URI issue (
 <i>argv[0]</i>
 and
 <b>DEVICE_URI</b>
index 16b8c23fd0270e2a0bbcf5e5fbafce6848822ae9..50aae4fb25664602447fa42a30297c7b3e0504af 100644 (file)
@@ -1650,16 +1650,24 @@ smart_strlcpy(char       *dst,          /* I - Output buffer */
       *dstptr++ = 0xc0 | (*srcptr >> 6);
       *dstptr++ = 0x80 | (*srcptr++ & 0x3f);
     }
-    else if ((*srcptr & 0xe0) == 0xc0)
+    else if ((*srcptr & 0xe0) == 0xc0 && (srcptr[1] & 0xc0) == 0x80)
     {
+     /*
+      * 2-byte UTF-8 sequence...
+      */
+
       if (dstptr > (dstend - 2))
         break;
 
       *dstptr++ = *srcptr++;
       *dstptr++ = *srcptr++;
     }
-    else if ((*srcptr & 0xf0) == 0xe0)
+    else if ((*srcptr & 0xf0) == 0xe0 && (srcptr[1] & 0xc0) == 0x80 && (srcptr[2] & 0xc0) == 0x80)
     {
+     /*
+      * 3-byte UTF-8 sequence...
+      */
+
       if (dstptr > (dstend - 3))
         break;
 
@@ -1667,8 +1675,12 @@ smart_strlcpy(char       *dst,           /* I - Output buffer */
       *dstptr++ = *srcptr++;
       *dstptr++ = *srcptr++;
     }
-    else if ((*srcptr & 0xf8) == 0xf0)
+    else if ((*srcptr & 0xf8) == 0xf0 && (srcptr[1] & 0xc0) == 0x80 && (srcptr[2] & 0xc0) == 0x80 && (srcptr[3] & 0xc0) == 0x80)
     {
+     /*
+      * 4-byte UTF-8 sequence...
+      */
+
       if (dstptr > (dstend - 4))
         break;
 
@@ -1680,7 +1692,7 @@ smart_strlcpy(char       *dst,            /* I - Output buffer */
     else
     {
      /*
-      * Orphan UTF-8 sequence, this must be an ISO-8859-1 string...
+      * Bad UTF-8 sequence, this must be an ISO-8859-1 string...
       */
 
       saw_8859 = 1;