summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-11-02 22:09:51 +0100
committerVolker Lendecke <vl@samba.org>2008-11-02 22:38:02 +0100
commite7607b95f281af349df34c5ba0b12673e6ed6250 (patch)
tree01b6ea5099d1c735329e0aee873e8d91d71d0ffc
parent17218df56714237d319673c17ddd2c75795d6285 (diff)
downloadsamba-e7607b95f281af349df34c5ba0b12673e6ed6250.tar.gz
samba-e7607b95f281af349df34c5ba0b12673e6ed6250.tar.bz2
samba-e7607b95f281af349df34c5ba0b12673e6ed6250.zip
Remove a direct inbuf reference in reply_negprot
-rw-r--r--source3/smbd/negprot.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index fe168aad3a..43fdc1d608 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -507,7 +507,6 @@ static const struct {
void reply_negprot(struct smb_request *req)
{
- size_t size = smb_len(req->inbuf) + 4;
int choice= -1;
int protocol;
const char *p;
@@ -527,7 +526,14 @@ void reply_negprot(struct smb_request *req)
}
done_negprot = True;
- if (req->inbuf[size-1] != '\0') {
+ if (req->buflen == 0) {
+ DEBUG(0, ("negprot got no protocols\n"));
+ reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
+ END_PROFILE(SMBnegprot);
+ return;
+ }
+
+ if (req->buf[req->buflen-1] != '\0') {
DEBUG(0, ("negprot protocols not 0-terminated\n"));
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBnegprot);