Fix a few issues reported by PVS-Studio

See http://www.viva64.com/en/b/0328/ for details

Change-Id: Ic9ddfd690b49401c96cb8a4a277c671f9824be31
Reviewed-on: https://code.wireshark.org/review/8775
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
Pascal Quantin 2015-06-05 15:43:10 +02:00
parent 244f2fbbf6
commit 1ec868eddd
5 changed files with 8 additions and 7 deletions

View File

@ -1129,7 +1129,7 @@ AirPDcapWepMng(
sa->key=tmp_key;
if (key!=NULL) {
memcpy(key, &sa->key, sizeof(AIRPDCAP_KEY_ITEM));
memcpy(key, sa->key, sizeof(AIRPDCAP_KEY_ITEM));
key->KeyType=AIRPDCAP_KEY_TYPE_WEP;
}

View File

@ -514,7 +514,7 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree
subsize = get_cmd_len(&ecHdr);
len = ecHdr.len & 0x07ff;
if ( len >= sizeof(ETHERCAT_MBOX_HEADER_LEN) &&
if ( len >= ETHERCAT_MBOX_HEADER_LEN &&
(ecHdr.cmd==EC_CMD_TYPE_FPWR || ecHdr.cmd==EC_CMD_TYPE_FPRD || ecHdr.cmd==EC_CMD_TYPE_APWR || ecHdr.cmd==EC_CMD_TYPE_APRD) &&
ecHdr.anAddrUnion.a.ado>=0x1000
)
@ -528,7 +528,7 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree
case ETHERCAT_MBOX_TYPE_FOE:
case ETHERCAT_MBOX_TYPE_COE:
case ETHERCAT_MBOX_TYPE_SOE:
if ( /*pMBox->Length > 0 &&*/ mbox.Length <= 1500 /*&& pMBox->Length+sizeof(ETHERCAT_MBOX_HEADER_LEN) >= len*/ )
if ( /*pMBox->Length > 0 &&*/ mbox.Length <= 1500 /*&& (pMBox->Length+ETHERCAT_MBOX_HEADER_LEN) >= len*/ )
{
bMBox = TRUE;
}

View File

@ -1108,8 +1108,9 @@ dissect_display_switch(proto_tree *msg_tree,
hf_display_write_address_char_pos,
tvb,offset,1,ENC_BIG_ENDIAN);
if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)!=
DISPLAY_WRITE_ADDRESS_LINE_FLAG)
DISPLAY_WRITE_ADDRESS_LINE_FLAG){
offset+=1;msg_len-=1;
}
}
if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)==
DISPLAY_WRITE_ADDRESS_LINE_FLAG){
@ -1169,8 +1170,9 @@ dissect_display_switch(proto_tree *msg_tree,
hf_display_write_address_char_pos,
tvb,offset,1,ENC_BIG_ENDIAN);
if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)!=
DISPLAY_WRITE_ADDRESS_LINE_FLAG)
DISPLAY_WRITE_ADDRESS_LINE_FLAG){
offset+=1;msg_len-=1;
}
}
if((address_byte&DISPLAY_WRITE_ADDRESS_LINE_FLAG)==
DISPLAY_WRITE_ADDRESS_LINE_FLAG){

View File

@ -1516,7 +1516,6 @@ void create_byte_graph(guint16 dir, struct sctp_analyse* userdata)
struct sctp_udata *u_data;
u_data=(struct sctp_udata *)g_malloc(sizeof(struct sctp_udata));
u_data->assoc=(sctp_assoc_info_t *)g_malloc(sizeof(sctp_assoc_info_t));
u_data->assoc=userdata->assoc;
u_data->io=NULL;
u_data->dir = dir;

View File

@ -1590,7 +1590,7 @@ q931_calls_packet(void *tap_offset_ptr, packet_info *pinfo, epan_dissect_t *edt,
/* check if the called number match a LRQ/LCF */
if ( (strcmp(callsinfo->to_identity, tmp_listinfo->to_identity)==0)
&& (memcmp(&tmp2_h323info->guid, &guid_allzero, GUID_LEN) == 0) ) {
&& (memcmp(tmp2_h323info->guid, &guid_allzero, GUID_LEN) == 0) ) {
/* change the call graph to the LRQ/LCF to belong to this call */
callsinfo->npackets += change_call_num_graph(tapinfo, tmp_listinfo->call_num, callsinfo->call_num);