diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-08-02 13:00:18 +0200 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2009-08-03 21:01:32 +0000 |
commit | 24e2fb615fd6b624c320cec9ea9d91a75dad902e (patch) | |
tree | f6849650d675636490a14659228ce9a18004bc77 /fs/cifs/cifs_unicode.c | |
parent | 4486d6ede16b362f89b29845af6fe1a26ae78a54 (diff) |
cifs: Read buffer overflow
Check whether index is within bounds before testing the element.
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifs_unicode.c')
-rw-r--r-- | fs/cifs/cifs_unicode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 60e3c4253de0..714a542cbafc 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c @@ -44,7 +44,7 @@ cifs_ucs2_bytes(const __le16 *from, int maxbytes, int maxwords = maxbytes / 2; char tmp[NLS_MAX_CHARSET_SIZE]; - for (i = 0; from[i] && i < maxwords; i++) { + for (i = 0; i < maxwords && from[i]; i++) { charlen = codepage->uni2char(le16_to_cpu(from[i]), tmp, NLS_MAX_CHARSET_SIZE); if (charlen > 0) |