fs/exfat: avoid setting 0 over buffer uniname
authorShiyong Li <a22381@motorola.com>
Sat, 9 Dec 2017 01:32:02 +0000 (17:32 -0800)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:51 +0000 (20:23 +0300)
commitb07862fd9bbec3816a8eb1aa350a6804bba87cb6
tree0a20886a0b9c851b3d3d1385d365f50b20532bce
parent69e75899f8394a0e45e98090bd57771405418eda
fs/exfat: avoid setting 0 over buffer uniname

utf8s_to_utf16s could return -EINVAL(-22), then uniname[i] =
uniname[-22] = '\0' will corrupt other local variable.
uniname is a local variable having different address everytime
when call nls_cstring_to_uniname. so uniname[-22] could corrupt
some different addresses.
and also when filename reaches at maximum length, need to leave
last one space in buffer for '\0'

Change-Id: I44bbdd3249150ad5617c7cd13207cfa37b102a77
Signed-off-by: Shengzhe Zhao <a18689@motorola.com>
Signed-off-by: Shiyong Li <a22381@motorola.com>
Reviewed-on: https://gerrit.mot.com/1102179
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Igor Kovalenko <igork@motorola.com>
Submit-Approved: Jira Key
Reviewed-on: https://gerrit.mot.com/1276880
Reviewed-by: Hua Tan <tanhua1@motorola.com>
fs/exfat/exfat_nls.c