Index: smbd/process.c =================================================================== --- smbd/process.c (revision 22143) +++ smbd/process.c (working copy) @@ -1153,8 +1153,8 @@ char outbuf_saved[smb_wct]; int outsize = smb_len(outbuf) + 4; - /* maybe its not chained */ - if (smb_com2 == 0xFF) { + /* Maybe its not chained, or it's an error packet. */ + if (smb_com2 == 0xFF || SVAL(outbuf,smb_rcls) != 0) { SCVAL(outbuf,smb_vwv0,0xFF); return outsize; } Index: smbd/reply.c =================================================================== --- smbd/reply.c (revision 22143) +++ smbd/reply.c (working copy) @@ -2705,8 +2705,10 @@ } nread = send_file_readX(conn, inbuf, outbuf, length, bufsize, fsp, startpos, smb_maxcnt); - if (nread != -1) + /* Only call chain_reply if not an error. */ + if (nread != -1 && SVAL(outbuf,smb_rcls) == 0) { nread = chain_reply(inbuf,outbuf,length,bufsize); + } END_PROFILE(SMBreadX); return nread;