From: Samba Release Account Date: Tue, 3 Dec 1996 19:05:27 +0000 (+0000) Subject: Added Volkers fix for bundary condition. Needed as word X-Git-Tag: samba-4.0.0alpha6~801^2~23295 X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=b02557f80e80e6fc270f253ba139ee8e4903a459;p=samba.git Added Volkers fix for bundary condition. Needed as word alignment wasn't being taken into account in space calculations. (This used to be commit 2fd77d66c0e93b381466e40bd34680468ac8ec77) --- diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 53af9acbf53..3b4cdeb1c66 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -68,16 +68,19 @@ static int send_trans2_replies(char *outbuf, int bufsize, char *params, } /* Space is bufsize minus Netbios over TCP header minus SMB header */ - /* The + 1 is to align the param and data bytes on an even byte + /* The alignment_offset is to align the param and data bytes on an even byte boundary. NT 4.0 Beta needs this to work correctly. */ useable_space = bufsize - ((smb_buf(outbuf)+alignment_offset) - outbuf); - useable_space = MIN(useable_space, maxxmit); /* XXX is this needed? correct? */ + /* useable_space can never be more than maxxmit minus the + alignment offset. */ + useable_space = MIN(useable_space, maxxmit - alignment_offset); while( params_to_send || data_to_send) { /* Calculate whether we will totally or partially fill this packet */ total_sent_thistime = params_to_send + data_to_send + alignment_offset; - total_sent_thistime = MIN(total_sent_thistime, useable_space); + /* We can never send more than maxxmit */ + total_sent_thistime = MIN(total_sent_thistime, maxxmit); set_message(outbuf, 10, total_sent_thistime, True);