]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - fs/smb/client/cifs_debug.c
smb: client: fix potential OOB in cifs_dump_detail()
[thirdparty/linux.git] / fs / smb / client / cifs_debug.c
index 5596c9f30ccb280f78834ee7dee05c437c265ce4..60027f5aebe87f2050584994ee68699ae7ed6e5b 100644 (file)
@@ -40,11 +40,13 @@ void cifs_dump_detail(void *buf, struct TCP_Server_Info *server)
 #ifdef CONFIG_CIFS_DEBUG2
        struct smb_hdr *smb = buf;
 
-       cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d\n",
-                smb->Command, smb->Status.CifsError,
-                smb->Flags, smb->Flags2, smb->Mid, smb->Pid);
-       cifs_dbg(VFS, "smb buf %p len %u\n", smb,
-                server->ops->calc_smb_size(smb));
+       cifs_dbg(VFS, "Cmd: %d Err: 0x%x Flags: 0x%x Flgs2: 0x%x Mid: %d Pid: %d Wct: %d\n",
+                smb->Command, smb->Status.CifsError, smb->Flags,
+                smb->Flags2, smb->Mid, smb->Pid, smb->WordCount);
+       if (!server->ops->check_message(buf, server->total_read, server)) {
+               cifs_dbg(VFS, "smb buf %p len %u\n", smb,
+                        server->ops->calc_smb_size(smb));
+       }
 #endif /* CONFIG_CIFS_DEBUG2 */
 }