[PATCH 1/3] nls: utf8_wcstombs: use correct buffer size in error case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When utf8_wcstombs encounters a character that cannot be encoded, we
must not decrease the remaining output buffer size because nothing has
been written to the output buffer.

Signed-off-by: Clemens Ladisch <clemens@xxxxxxxxxx>

--- linux-2.6.orig/fs/nls/nls_base.c
+++ linux-2.6/fs/nls/nls_base.c
@@ -144,7 +144,6 @@ utf8_wcstombs(__u8 *s, const wchar_t *pw
 			size = utf8_wctomb(op, *ip, maxlen);
 			if (size == -1) {
 				/* Ignore character and move on */
-				maxlen--;
 			} else {
 				op += size;
 				maxlen -= size;
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux