Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)