aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-10-04 08:23:03 +0200
committerIngo Molnar <mingo@kernel.org>2018-10-04 08:23:03 +0200
commitc0554d2d3db438623b4f2f9abc3d766b2b15d2fb (patch)
treed00dc324772b95373f4bdc566b3437e5bf637157 /fs/cifs/cifssmb.c
parentbef459026b161fbc39d20dcba698ed0cfffbac38 (diff)
parent1d2ba7fee28b3a47cca8e8f4f94a22d30b2b3a6f (diff)
downloadlinux-c0554d2d3db438623b4f2f9abc3d766b2b15d2fb.tar.gz
Merge branch 'linus' into x86/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index dc2f4cf08fe9..5657b79dbc99 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -601,10 +601,15 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
}
count = 0;
+ /*
+ * We know that all the name entries in the protocols array
+ * are short (< 16 bytes anyway) and are NUL terminated.
+ */
for (i = 0; i < CIFS_NUM_PROT; i++) {
- strncpy(pSMB->DialectsArray+count, protocols[i].name, 16);
- count += strlen(protocols[i].name) + 1;
- /* null at end of source and target buffers anyway */
+ size_t len = strlen(protocols[i].name) + 1;
+
+ memcpy(pSMB->DialectsArray+count, protocols[i].name, len);
+ count += len;
}
inc_rfc1001_len(pSMB, count);
pSMB->ByteCount = cpu_to_le16(count);