coverity fix - 1.1beta branch - add some comments to indicate false positives by coverity for future reference - mainly comments for switch statement fall through

remotes/origin/master-1.1.x
Anoop Saldanha 15 years ago committed by Victor Julien
parent df3ca322a4
commit be3996ac02

@ -118,6 +118,9 @@ static int DCERPCUDPParseHeader(Flow *f, void *dcerpcudp_state,
if (input_len) {
switch (sstate->bytesprocessed) {
case 0:
// fallthrough
/* above statement to prevent coverity FPs from the switch
* fall through */
if (input_len >= DCERPC_UDP_HDR_LEN) {
sstate->dcerpc.dcerpchdrudp.rpc_vers = *p;
if (sstate->dcerpc.dcerpchdrudp.rpc_vers != 4) {
@ -257,6 +260,8 @@ static int DCERPCUDPParseHeader(Flow *f, void *dcerpcudp_state,
}
if (!(--input_len))
break;
/* We fall through to the next case if we still have input.
* Same applies for other cases as well */
}
case 1:
sstate->dcerpc.dcerpchdrudp.type = *(p++);

@ -835,6 +835,9 @@ static int SMBParseHeader(Flow *f, void *smb_state,
if (input_len > 0) {
switch (sstate->bytesprocessed) {
case 4:
// fallthrough
/* above statement to prevent coverity FPs from the switch
* fall through */
if (input_len >= SMB_HDR_LEN) {
if (SCMemcmp(p, "\xff\x53\x4d\x42", 4) != 0) {
SCLogDebug("SMB Header did not validate");
@ -876,6 +879,8 @@ static int SMBParseHeader(Flow *f, void *smb_state,
}
if (!(--input_len))
break;
/* We fall through to the next case if we still have input.
* Same applies for other cases as well */
}
case 5:
if (*(p++) != 'S') {

@ -101,6 +101,9 @@ static uint32_t SMB2ParseHeader(void *smb2_state, AppLayerParserState *pstate,
if (input_len) {
switch (sstate->bytesprocessed) {
case 4:
// fallthrough
/* above statement to prevent coverity FPs from the switch
* fall through */
if (input_len >= SMB2_HDR_LEN) {
if (SCMemcmp(p, "\xfe\x53\x4d\x42", 4) != 0) {
//printf("SMB2 Header did not validate\n");
@ -173,7 +176,10 @@ static uint32_t SMB2ParseHeader(void *smb2_state, AppLayerParserState *pstate,
//sstate->smb2.protocol[0] = *(p++);
if (*(p++) != 0xfe)
return 0;
if (!(--input_len)) break;
if (!(--input_len))
break;
/* We fall through to the next case if we still have input.
* Same applies for other cases as well */
}
case 5:
//sstate->smb2.protocol[1] = *(p++);

Loading…
Cancel
Save