Commit 24e2fb61 authored by Roel Kluin's avatar Roel Kluin Committed by Steve French

cifs: Read buffer overflow

Check whether index is within bounds before testing the element.
Acked-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 4486d6ed
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment