Skip to content

Commit

Permalink
cifs: Read buffer overflow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roel Kluin authored and Steve French committed Aug 3, 2009
1 parent 4486d6e commit 24e2fb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/cifs/cifs_unicode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 24e2fb6

Please sign in to comment.