diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2021-03-05 15:02:34 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2021-04-25 16:28:23 -0500 |
commit | 8d7672235533dbeab4a5373b49f1b4273cdc2c6a (patch) | |
tree | e86654fbc3d834f515bcc97d77f36ae7ba5649d4 /fs/cifs/smb1ops.c | |
parent | b9335f621064b95bbf3e9473e228c4b328ff3e8a (diff) | |
download | linux-rpi-8d7672235533dbeab4a5373b49f1b4273cdc2c6a.tar.gz linux-rpi-8d7672235533dbeab4a5373b49f1b4273cdc2c6a.tar.bz2 linux-rpi-8d7672235533dbeab4a5373b49f1b4273cdc2c6a.zip |
cifs: don't cargo-cult strndup()
strndup(s, strlen(s)) is a highly unidiomatic way to spell strdup(s);
it's *NOT* safer in any way, since strlen() is just as sensitive to
NUL-termination as strdup() is.
strndup() is for situations when you need a copy of a known-sized
substring, not a magic security juju to drive the bad spirits away.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/smb1ops.c')
-rw-r--r-- | fs/cifs/smb1ops.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index e31b939e628c..85fa254c7a6b 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -926,9 +926,7 @@ cifs_unix_dfs_readlink(const unsigned int xid, struct cifs_tcon *tcon, 0); if (!rc) { - *symlinkinfo = kstrndup(referral.node_name, - strlen(referral.node_name), - GFP_KERNEL); + *symlinkinfo = kstrdup(referral.node_name, GFP_KERNEL); free_dfs_info_param(&referral); if (!*symlinkinfo) rc = -ENOMEM; |