From ce55c2612c7e39579ff149e25195e0f00d627713 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Tue, 16 Dec 2003 01:52:54 +0000 Subject: [PATCH] Avoid sign extension when casting signed characters to unsigned wide characters in ntfs_u28(). This fixes the conversion of filenames containing single-byte characters with the high bit set. --- sys/fs/ntfs/ntfs_subr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index aff97a36e24..ee1c71b2a1b 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -2157,7 +2157,7 @@ ntfs_u28( ntfs_iconv->convchr(ntmp->ntm_ic_u2l, (const char **)&p, &ilen, &outp, &olen); if (olen == 1) { - return ((wchar)(outbuf[0])); + return ((wchar)(outbuf[0]&0xFF)); } else if (olen == 0) { return ((wchar)((outbuf[0]<<8) | (outbuf[1]&0xFF))); } @@ -2167,7 +2167,7 @@ ntfs_u28( p = ntmp->ntm_u28[(wc>>8)&0xFF]; if (p == NULL) return ('_'); - return (p[wc&0xFF]); + return (p[wc&0xFF]&0xFF); } wchar -- 2.45.2