[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250705161515.12202-1-dinghui@sangfor.com.cn>
Date: Sun, 6 Jul 2025 00:15:15 +0800
From: Ding Hui <dinghui@...gfor.com.cn>
To: sfrench@...ba.org,
pc@...guebit.org,
ronniesahlberg@...il.com,
sprasad@...rosoft.com,
tom@...pey.com,
bharathsm@...rosoft.com,
piastry@...rsoft.ru,
samba-technical@...ts.samba.org,
linux-kernel@...r.kernel.org
Cc: Ding Hui <dinghui@...gfor.com.cn>
Subject: [PATCH] cifs: fix an OOB issue in cifsConvertToUTF16()
The OOB can be triggered by making symlink in reparse=native mode.
Limit the srclen can not greater than maxlen.
Fixes: 2503a0dba989 ("CIFS: Add SMB2 support for is_path_accessible")
Signed-off-by: Ding Hui <dinghui@...gfor.com.cn>
---
fs/smb/client/cifs_unicode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/smb/client/cifs_unicode.c b/fs/smb/client/cifs_unicode.c
index 4cc6e0896fad..cee43e71fa87 100644
--- a/fs/smb/client/cifs_unicode.c
+++ b/fs/smb/client/cifs_unicode.c
@@ -636,7 +636,7 @@ cifs_strndup_to_utf16(const char *src, const int maxlen, int *utf16_len,
*utf16_len = 0;
return NULL;
}
- cifsConvertToUTF16(dst, src, strlen(src), cp, remap);
+ cifsConvertToUTF16(dst, src, strnlen(src, maxlen), cp, remap);
*utf16_len = len;
return dst;
}
--
2.17.1
Powered by blists - more mailing lists