smb: fix invalid username check in smb3_fs_context_parse_param()
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- fs/smb/client/fs_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/fs_context.c +1 -1
@@ -1470,7 +1470,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,break ; } -if (strnlen (param->string,CIFS_MAX_USERNAME_LEN ) > +if (strnlen (param->string,CIFS_MAX_USERNAME_LEN ) ==CIFS_MAX_USERNAME_LEN ) {pr_warn ("username too long\n" ); goto cifs_parse_mount_err;
Signature · 1 line
2.34.1
tentatively applied to for-next pending review and testing
Quoted 29 lines · Yiqi Sun
Since the maximum return value of
strnlen(..., CIFS_MAX_USERNAME_LEN)isCIFS_MAX_USERNAME_LEN, length check insmb3_fs_context_parse_param()is always FALSE and invalid.Fix the comparison in if statement.
Signed-off-by Yiqi Sun <[email protected]>--- fs/smb/client/fs_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/smb/client/fs_context.c +1
-2@@ -1470,7 +1470,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,break ; } -if (strnlen (param->string,CIFS_MAX_USERNAME_LEN ) > +if (strnlen (param->string,CIFS_MAX_USERNAME_LEN ) ==CIFS_MAX_USERNAME_LEN ) {pr_warn ("username too long\n" ); goto cifs_parse_mount_err; --2.34.1
Signature · 3 lines
Thanks, Steve