summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1996-12-03 19:05:27 +0000
committerSamba Release Account <samba-bugs@samba.org>1996-12-03 19:05:27 +0000
commitb02557f80e80e6fc270f253ba139ee8e4903a459 (patch)
tree5880974a58a926b9120421ba5db6eb7560201e5b
parent1f076e2d1209fbf6136fdb4c14062f421ea942c1 (diff)
downloadsamba-b02557f80e80e6fc270f253ba139ee8e4903a459.tar.gz
samba-b02557f80e80e6fc270f253ba139ee8e4903a459.tar.bz2
samba-b02557f80e80e6fc270f253ba139ee8e4903a459.zip
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)
-rw-r--r--source3/smbd/trans2.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 53af9acbf5..3b4cdeb1c6 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);