cifs: fix an OOB issue in cifsConvertToUTF16()
PATCH 1/1 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 <[email protected]>
--- fs/smb/client/cifs_unicode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/cifs_unicode.c +1 -1
@@ -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; }
Signature · 1 line
2.17.1