edf173c
diff -up cups-2.2.1/CHANGES.txt.iso88591 cups-2.2.1/CHANGES.txt
edf173c
--- cups-2.2.1/CHANGES.txt.iso88591	2016-11-11 13:59:27.597903504 +0100
edf173c
+++ cups-2.2.1/CHANGES.txt	2016-11-11 14:08:29.149806797 +0100
edf173c
@@ -1,6 +1,13 @@
edf173c
-CHANGES.txt - 2.2.1 - 2016-10-03
edf173c
+CHANGES.txt - 2.2.2 - 2016-10-13
edf173c
+
edf173c
 --------------------------------
edf173c
 
edf173c
+CHANGES IN CUPS V2.2.2
edf173c
+
edf173c
+	- The cups-lpd program did not catch all legacy usage of ISO-8859-1
edf173c
+          (Issue #4899)
edf173c
+
edf173c
+
edf173c
 CHANGES IN CUPS V2.2.1
edf173c
 
edf173c
 	- Added "CreateSelfSignedCerts" directive for cups-files.conf to
edf173c
diff -up cups-2.2.1/doc/help/man-backend.html.iso88591 cups-2.2.1/doc/help/man-backend.html
edf173c
--- cups-2.2.1/doc/help/man-backend.html.iso88591	2016-11-11 14:00:00.589652892 +0100
edf173c
+++ cups-2.2.1/doc/help/man-backend.html	2016-11-11 14:10:54.663706372 +0100
edf173c
@@ -61,7 +61,7 @@ function may be used to retrieve the cor
edf173c
 

Backends are responsible for reading side-channel requests using the

edf173c
 cupsSideChannelRead()
edf173c
 function and responding with the
edf173c
-cupsSideChannelWrite()
edf173c
+cupsSideChannelWrite()
edf173c
 function. The
edf173c
 CUPS_SC_FD
edf173c
 constant defines the file descriptor that should be monitored for incoming requests.
edf173c
@@ -147,7 +147,7 @@ CUPS backends can expect the following e
edf173c
 

Files

edf173c
 /etc/cups/cups-files.conf
edf173c
 

Notes

edf173c
-CUPS backends are not generally design to be run directly by the user. Aside from the device URI issue (
edf173c
+CUPS backends are not generally designed to be run directly by the user. Aside from the device URI issue (
edf173c
 argv[0]
edf173c
 and
edf173c
 DEVICE_URI
edf173c
diff -up cups-2.2.1/scheduler/cups-lpd.c.iso88591 cups-2.2.1/scheduler/cups-lpd.c
edf173c
--- cups-2.2.1/scheduler/cups-lpd.c.iso88591	2016-11-11 14:00:37.140376293 +0100
edf173c
+++ cups-2.2.1/scheduler/cups-lpd.c	2016-11-11 14:15:09.836776667 +0100
edf173c
@@ -1650,16 +1650,24 @@ smart_strlcpy(char       *dst,		/* I - O
edf173c
       *dstptr++ = 0xc0 | (*srcptr >> 6);
edf173c
       *dstptr++ = 0x80 | (*srcptr++ & 0x3f);
edf173c
     }
edf173c
-    else if ((*srcptr & 0xe0) == 0xc0)
edf173c
+    else if ((*srcptr & 0xe0) == 0xc0 && (srcptr[1] & 0xc0) == 0x80)
edf173c
     {
edf173c
+     /*
edf173c
+      * 2-byte UTF-8 sequence...
edf173c
+      */
edf173c
+
edf173c
       if (dstptr > (dstend - 2))
edf173c
         break;
edf173c
 
edf173c
       *dstptr++ = *srcptr++;
edf173c
       *dstptr++ = *srcptr++;
edf173c
     }
edf173c
-    else if ((*srcptr & 0xf0) == 0xe0)
edf173c
+    else if ((*srcptr & 0xf0) == 0xe0 && (srcptr[1] & 0xc0) == 0x80 && (srcptr[2] & 0xc0) == 0x80)
edf173c
     {
edf173c
+     /*
edf173c
+      * 3-byte UTF-8 sequence...
edf173c
+      */
edf173c
+
edf173c
       if (dstptr > (dstend - 3))
edf173c
         break;
edf173c
 
edf173c
@@ -1667,8 +1675,12 @@ smart_strlcpy(char       *dst,		/* I - O
edf173c
       *dstptr++ = *srcptr++;
edf173c
       *dstptr++ = *srcptr++;
edf173c
     }
edf173c
-    else if ((*srcptr & 0xf8) == 0xf0)
edf173c
+    else if ((*srcptr & 0xf8) == 0xf0 && (srcptr[1] & 0xc0) == 0x80 && (srcptr[2] & 0xc0) == 0x80 && (srcptr[3] & 0xc0) == 0x80)
edf173c
     {
edf173c
+     /*
edf173c
+      * 4-byte UTF-8 sequence...
edf173c
+      */
edf173c
+
edf173c
       if (dstptr > (dstend - 4))
edf173c
         break;
edf173c
 
edf173c
@@ -1680,7 +1692,7 @@ smart_strlcpy(char       *dst,		/* I - O
edf173c
     else
edf173c
     {
edf173c
      /*
edf173c
-      * Orphan UTF-8 sequence, this must be an ISO-8859-1 string...
edf173c
+      * Bad UTF-8 sequence, this must be an ISO-8859-1 string...
edf173c
       */
edf173c
 
edf173c
       saw_8859 = 1;