fix the 'then' statement is equivalent to the 'else' statement found by PVS Studio (V523)

Change-Id: I016e69f43bad98eb0604852ea658adaa5fe77c12
Reviewed-on: https://code.wireshark.org/review/8786
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Alexis La Goutte 2015-06-06 15:07:53 +02:00 committed by Anders Broman
parent 3f5d183a44
commit 7e62a03830
4 changed files with 11 additions and 37 deletions

View File

@ -3303,14 +3303,7 @@ printf("SQ OF dissect_ber_sq_of(%s) entered\n", name);
/* first we must read the sequence header */
offset = dissect_ber_identifier(actx->pinfo, tree, tvb, offset, &classx, &pcx, &tagx);
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &lenx, &ind);
if (ind) {
/* if the length is indefinite we don't really know (yet) where the
* object ends so assume it spans the rest of the tvb for now.
*/
end_offset = offset + lenx;
} else {
end_offset = offset + lenx;
}
end_offset = offset + lenx;
/* sanity check: we only handle Constructed Universal Sequences */
if ((classx != BER_CLASS_APP) && (classx != BER_CLASS_PRI)) {

View File

@ -2994,11 +2994,7 @@ cigi2_add_tree(tvbuff_t *tvb, proto_tree *cigi_tree)
offset = cigi2_add_image_generator_message(tvb, cigi_packet_tree, offset);
break;
default:
if ( packet_id >= CIGI2_PACKET_ID_USER_DEFINABLE_MIN && packet_id <= CIGI2_PACKET_ID_USER_DEFINABLE_MAX ) {
offset = cigi_add_data(tvb, cigi_packet_tree, offset);
} else {
offset = cigi_add_data(tvb, cigi_packet_tree, offset);
}
offset = cigi_add_data(tvb, cigi_packet_tree, offset);
break;
}

View File

@ -1052,22 +1052,12 @@ gboolean eosmb_take_name_as_fid = FALSE ;
const gchar *tree_ip_str(packet_info *pinfo, guint16 cmd) {
const gchar *buf;
if (pinfo->src.type == AT_IPv4) {
if ( cmd == SMB_COM_READ_ANDX ||
cmd == SMB_COM_READ ||
cmd == SMB2_COM_READ) {
buf = address_to_str(wmem_packet_scope(), &pinfo->src);
} else {
buf = address_to_str(wmem_packet_scope(), &pinfo->dst);
}
if ( cmd == SMB_COM_READ_ANDX ||
cmd == SMB_COM_READ ||
cmd == SMB2_COM_READ) {
buf = address_to_str(wmem_packet_scope(), &pinfo->src);
} else {
if ( cmd == SMB_COM_READ_ANDX ||
cmd == SMB_COM_READ ||
cmd == SMB2_COM_READ) {
buf = address_to_str(wmem_packet_scope(), &pinfo->src);
} else {
buf = address_to_str(wmem_packet_scope(), &pinfo->dst);
}
buf = address_to_str(wmem_packet_scope(), &pinfo->dst);
}
return buf;

View File

@ -3339,15 +3339,10 @@ dissect_spice(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
} else {
pdu_len = sizeof_SpiceDataHeader;
GET_PDU_FROM_OFFSET(offset)
pdu_len = tvb_get_letohl(tvb, offset + 14); /* this is actually the sub-message list size */
if (pdu_len == 0) {
/* if there are no sub-messages, get the usual message body size. */
/* Note that we do not dissect properly yet sub-messages - but they */
/* are not used in the protcol either */
pdu_len = tvb_get_letohl(tvb, offset + 10);
} else {
pdu_len = tvb_get_letohl(tvb, offset + 10);
}
/* if there are no sub-messages, get the usual message body size. */
/* Note that we do not dissect properly yet sub-messages - but they */
/* are not used in the protcol either */
pdu_len = tvb_get_letohl(tvb, offset + 10);
pdu_len += sizeof_SpiceDataHeader; /* +sizeof_SpiceDataHeader since you need to exclude the SPICE */
/* data header, which is sizeof_SpiceDataHeader (18) bytes long) */
}