Project

General

Profile

Bug #88 » 0003-fix-bug88.patch

Kirby Kuehl, 02/11/2010 04:50 PM

View differences:

src/app-layer-dcerpc.c
hdrretval = DCERPCParseHeader(dcerpc, input, input_len);
if (hdrretval == -1) {
dcerpc->bytesprocessed = 0;
SCReturnInt(-1);
SCReturnInt(hdrretval);
} else {
parsed += hdrretval;
input_len -= hdrretval;
......
} else if (input_len) {
SCLogDebug("Error parsing DCERPC Request");
parsed -= input_len;
dcerpc->padleft = 0;
input_len = 0;
}
}
while (dcerpc->bytesprocessed >= DCERPC_HDR_LEN + 8
&& dcerpc->bytesprocessed < dcerpc->dcerpchdr.frag_length
&& input_len) {
&& input_len && dcerpc->padleft) {
retval = StubDataParser(dcerpc, input + parsed, input_len);
if (retval) {
parsed += retval;
src/app-layer-smb.c
SCEnter();
SMBState *sstate = (SMBState *) smb_state;
long int retval = 0;
long int parsed = 0;
if (pstate == NULL)
uint64_t retval = 0;
uint64_t parsed = 0;
int hdrretval = 0;
if (pstate == NULL) {
SCReturnInt(-1);
}
while (input_len && sstate->bytesprocessed < NBSS_HDR_LEN) {
retval
= NBSSParseHeader(f, smb_state, pstate, input, input_len,
......
parsed += retval;
input_len -= retval;
SCLogDebug(
"NBSS Header (%u/%u) Type 0x%02x Length 0x%04x parsed %ld input_len %u",
"[1] NBSS Header (%u/%u) Type 0x%02x Length 0x%04x parsed %"PRIu64" input_len %u\n",
sstate->bytesprocessed, NBSS_HDR_LEN, sstate->nbss.type,
sstate->nbss.length, parsed, input_len);
} else if (input_len) {
......
case NBSS_SESSION_MESSAGE:
while (input_len && (sstate->bytesprocessed >= NBSS_HDR_LEN
&& sstate->bytesprocessed < NBSS_HDR_LEN + SMB_HDR_LEN)) {
retval = SMBParseHeader(f, smb_state, pstate, input + parsed,
hdrretval = SMBParseHeader(f, smb_state, pstate, input + parsed,
input_len, output);
if (retval == -1) {
if (hdrretval == -1) {
SCLogDebug("Error parsing SMB Header\n");
sstate->bytesprocessed = 0;
SCReturnInt(-1);
SCReturnInt(hdrretval);
} else {
parsed += retval;
input_len -= retval;
parsed += hdrretval;
input_len -= hdrretval;
SCLogDebug(
"SMB Header (%u/%u) Command 0x%02x parsed %ld input_len %u",
"[2] SMB Header (%u/%u) Command 0x%02x parsed %"PRIu64" input_len %u\n",
sstate->bytesprocessed, NBSS_HDR_LEN + SMB_HDR_LEN,
sstate->smb.command, parsed, input_len);
}
......
SCReturnInt(-1);
}
}
SCLogDebug("SMB Header (%u/%u) Command 0x%02x WordCount %u parsed %ld input_len %u\n",
SCLogDebug("[3] WordCount SMB Header (%u/%u) Command 0x%02x WordCount %u parsed %"PRIu64" input_len %u\n",
sstate->bytesprocessed, NBSS_HDR_LEN + SMB_HDR_LEN + 1,
sstate->smb.command, sstate->wordcount.wordcount,
parsed, input_len);
......
SCReturnInt(-1);
}
}
SCLogDebug("[4] Parsing WordCount SMB Header (%u/%u) Command 0x%02x WordCount %u parsed %"PRIu64" input_len %u\n",
sstate->bytesprocessed, NBSS_HDR_LEN + SMB_HDR_LEN + 1 + sstate->wordcount.wordcount,
sstate->smb.command, sstate->wordcount.wordcount,
parsed, input_len);
while (input_len && (sstate->bytesprocessed >= NBSS_HDR_LEN
+ SMB_HDR_LEN + 1 + sstate->wordcount.wordcount
......
SCReturnInt(-1);
}
}
SCLogDebug("[6] ByteCount SMB Header (%u/%u) Command 0x%02x WordCount %u ByteCount %u parsed %"PRIu64" input_len %u\n",
sstate->bytesprocessed, NBSS_HDR_LEN + SMB_HDR_LEN + 1 + sstate->wordcount.wordcount + 2 + sstate->bytecount.bytecount,
sstate->smb.command, sstate->wordcount.wordcount,
sstate->bytecount.bytecount, parsed, input_len);
} while (sstate->andx.andxcommand != SMB_NO_SECONDARY_ANDX_COMMAND
&& input_len);
(4-4/4)