linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cifs: fix strcat buffer overflow in smb21_set_oplock_level()
@ 2019-05-06 15:16 Christoph Probst
  2019-05-06 16:53 ` Steve French
  0 siblings, 1 reply; 8+ messages in thread
From: Christoph Probst @ 2019-05-06 15:16 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, samba-technical, linux-kernel, Christoph Probst

Change strcat to strcpy in the "None" case as it is never valid to append
"None" to any other message. It may also overflow char message[5], in a
race condition on cinode if cinode->oplock is unset by another thread
after "RHW" or "RH" had been written to message.

Signed-off-by: Christoph Probst <kernel@probst.it>
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index c36ff0d..5fd5567 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2936,7 +2936,7 @@ smb21_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
 		strcat(message, "W");
 	}
 	if (!cinode->oplock)
-		strcat(message, "None");
+		strcpy(message, "None");
 	cifs_dbg(FYI, "%s Lease granted on inode %p\n", message,
 		 &cinode->vfs_inode);
 }
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-05-07 11:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06 15:16 [PATCH] cifs: fix strcat buffer overflow in smb21_set_oplock_level() Christoph Probst
2019-05-06 16:53 ` Steve French
2019-05-06 16:56   ` Jeremy Allison
2019-05-06 17:02     ` Steve French
2019-05-06 19:03       ` Pavel Shilovsky
2019-05-06 21:18         ` Steve French
2019-05-07  6:10           ` Christoph Probst
2019-05-07 11:02             ` David Laight

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).