Skip to content

Commit ed66121

Browse files
sunichismfrench
authored andcommitted
smb: fix invalid username check in smb3_fs_context_parse_param()
Since the maximum return value of strnlen(..., CIFS_MAX_USERNAME_LEN) is CIFS_MAX_USERNAME_LEN, length check in smb3_fs_context_parse_param() is always FALSE and invalid. Fix the comparison in if statement. Signed-off-by: Yiqi Sun <sunyiqixm@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent e8c73eb commit ed66121

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/smb/client/fs_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
14701470
break;
14711471
}
14721472

1473-
if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) >
1473+
if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) ==
14741474
CIFS_MAX_USERNAME_LEN) {
14751475
pr_warn("username too long\n");
14761476
goto cifs_parse_mount_err;

0 commit comments

Comments
 (0)