lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4FB2E1C7.1070700@gmail.com>
Date:	Wed, 16 May 2012 01:07:51 +0200
From:	Vladimir 'φ-coder/phcoder' Serbinenko 
	<phcoder@...il.com>
To:	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 5/8] Support non-BMP characters on Joliet.


Signed-off-by: Vladimir Serbinenko <phcoder@...il.com>
---
 fs/isofs/joliet.c |   23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c
index a048de8..d85e842 100644
--- a/fs/isofs/joliet.c
+++ b/fs/isofs/joliet.c
@@ -16,22 +16,35 @@
 static int
 uni16_to_x8(unsigned char *ascii, __be16 *uni, int len, struct nls_table *nls)
 {
-	__be16 *ip, ch;
+	__be16 *ip, ch[2];
 	unsigned char *op;
 
 	ip = uni;
 	op = ascii;
 
-	while ((ch = get_unaligned(ip)) && len) {
+	ch[1] = get_unaligned(ip);
+
+	while (len) {
 		int llen;
-		llen = nls->uni2char(be16_to_cpu(ch), op, NLS_MAX_CHARSET_SIZE);
+		int s;
+		unicode_t uni;
+		ch[0] = ch[1];
+		if (len > 1)
+			ch[1] = get_unaligned(ip + 1);
+		s = utf16s_to_unicode(ch, len > 1 ? 2 : 1, UTF16_BIG_ENDIAN,
+				      &uni);
+		if (s <= 0) {
+			llen = -1;
+			s = 1;
+		} else
+			llen = nls->uni2char(uni, op, NLS_MAX_CHARSET_SIZE);
 		if (llen > 0)
 			op += llen;
 		else
 			*op++ = '?';
-		ip++;
+		ip += s;
 
-		len--;
+		len -= s;
 	}
 	*op = 0;
 	return (op - ascii);
-- 
1.7.10

-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


Download attachment "signature.asc" of type "application/pgp-signature" (295 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ