]> git.baikalelectronics.ru Git - kernel.git/commit
cifs: potential buffer overflow in handling symlinks
authorHarshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Wed, 13 Apr 2022 11:42:51 +0000 (04:42 -0700)
committerSteve French <stfrench@microsoft.com>
Wed, 13 Apr 2022 17:00:49 +0000 (12:00 -0500)
commit3a4feca0ffb3f157e3dc55864f19532467ab0564
treeee678309f2a4a7c47664fc0a436d5d6968046c65
parentafdd7aac83cfa6a3de6dddfe384529c3c6ff99d1
cifs: potential buffer overflow in handling symlinks

Smatch printed a warning:
arch/x86/crypto/poly1305_glue.c:198 poly1305_update_arch() error:
__memcpy() 'dctx->buf' too small (16 vs u32max)

It's caused because Smatch marks 'link_len' as untrusted since it comes
from sscanf(). Add a check to ensure that 'link_len' is not larger than
the size of the 'link_str' buffer.

Fixes: 03f591c8df5c ("cifs: implement CIFSParseMFSymlink()")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/link.c