aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2011-02-17 01:11:05 +0000
committerGerald Combs <gerald@wireshark.org>2011-02-17 01:11:05 +0000
commit7b254f46fb8aeb82d9120dc62f0f12cbf4eda321 (patch)
tree65ce99f459b07edf5c6e394013ffd3a593994f19 /epan
parent69901e8eba7d3538773119066139008dee5f7538 (diff)
Fix some Visual C++ static analyzer complaints.
svn path=/trunk/; revision=35971
Diffstat (limited to 'epan')
-rw-r--r--epan/addr_resolv.c20
-rw-r--r--epan/dissectors/packet-btobex.c4
-rw-r--r--epan/dissectors/packet-isakmp.c4
-rw-r--r--epan/dissectors/packet-iwarp-mpa.c4
-rw-r--r--epan/dissectors/packet-mount.c2
5 files changed, 20 insertions, 14 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 5e05d68416..a52981bd57 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -1213,7 +1213,7 @@ get_ethbyname(const gchar *name)
set_ethent(g_pethers_path);
- while ((eth = get_ethent(NULL, FALSE)) && strncmp(name, eth->name, MAXNAMELEN) != 0)
+ while (((eth = get_ethent(NULL, FALSE)) != NULL) && strncmp(name, eth->name, MAXNAMELEN) != 0)
;
if (eth == NULL) {
@@ -1221,7 +1221,7 @@ get_ethbyname(const gchar *name)
set_ethent(g_ethers_path);
- while ((eth = get_ethent(NULL, FALSE)) && strncmp(name, eth->name, MAXNAMELEN) != 0)
+ while (((eth = get_ethent(NULL, FALSE)) != NULL) && strncmp(name, eth->name, MAXNAMELEN) != 0)
;
end_ethent();
@@ -1239,7 +1239,7 @@ get_ethbyaddr(const guint8 *addr)
set_ethent(g_pethers_path);
- while ((eth = get_ethent(NULL, FALSE)) && memcmp(addr, eth->addr, 6) != 0)
+ while (((eth = get_ethent(NULL, FALSE)) != NULL) && memcmp(addr, eth->addr, 6) != 0)
;
if (eth == NULL) {
@@ -1247,7 +1247,7 @@ get_ethbyaddr(const guint8 *addr)
set_ethent(g_ethers_path);
- while ((eth = get_ethent(NULL, FALSE)) && memcmp(addr, eth->addr, 6) != 0)
+ while (((eth = get_ethent(NULL, FALSE)) != NULL) && memcmp(addr, eth->addr, 6) != 0)
;
end_ethent();
@@ -1332,7 +1332,7 @@ add_manuf_name(const guint8 *addr, unsigned int mask, gchar *name)
hashmanuf_t *mtp;
hashwka_t *(*wka_tp)[HASHETHSIZE], *wtp;
- if (mask == 48) {
+ if (mask >= 48) {
/* This is a well-known MAC address; just add this to the Ethernet
hash table */
add_eth_name(addr, name);
@@ -1832,7 +1832,7 @@ get_ipxnetbyname(const gchar *name)
set_ipxnetent(g_ipxnets_path);
- while ((ipxnet = get_ipxnetent()) && strncmp(name, ipxnet->name, MAXNAMELEN) != 0)
+ while (((ipxnet = get_ipxnetent()) != NULL) && strncmp(name, ipxnet->name, MAXNAMELEN) != 0)
;
if (ipxnet == NULL) {
@@ -1840,7 +1840,7 @@ get_ipxnetbyname(const gchar *name)
set_ipxnetent(g_pipxnets_path);
- while ((ipxnet = get_ipxnetent()) && strncmp(name, ipxnet->name, MAXNAMELEN) != 0)
+ while (((ipxnet = get_ipxnetent()) != NULL) && strncmp(name, ipxnet->name, MAXNAMELEN) != 0)
;
end_ipxnetent();
@@ -1857,14 +1857,14 @@ get_ipxnetbyaddr(guint32 addr)
set_ipxnetent(g_ipxnets_path);
- while ((ipxnet = get_ipxnetent()) && (addr != ipxnet->addr) ) ;
+ while (((ipxnet = get_ipxnetent()) != NULL) && (addr != ipxnet->addr) ) ;
if (ipxnet == NULL) {
end_ipxnetent();
set_ipxnetent(g_pipxnets_path);
- while ((ipxnet = get_ipxnetent()) && (addr != ipxnet->addr) )
+ while (((ipxnet = get_ipxnetent()) != NULL) && (addr != ipxnet->addr) )
;
end_ipxnetent();
@@ -2466,7 +2466,7 @@ host_name_lookup_process(gpointer data _U_) {
async_dns_queue_head = g_list_first(async_dns_queue_head);
- while (async_dns_queue_head && async_dns_in_flight <= prefs.name_resolve_concurrency) {
+ while (async_dns_queue_head != NULL && async_dns_in_flight <= prefs.name_resolve_concurrency) {
caqm = (async_dns_queue_msg_t *) async_dns_queue_head->data;
async_dns_queue_head = g_list_remove(async_dns_queue_head, (void *) caqm);
if (caqm->family == AF_INET) {
diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c
index 3ce630d0f9..07ad3c231d 100644
--- a/epan/dissectors/packet-btobex.c
+++ b/epan/dissectors/packet-btobex.c
@@ -514,7 +514,9 @@ dissect_btobex(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if( (code < BTOBEX_CODE_VALS_CONTINUE) || (code == BTOBEX_CODE_VALS_ABORT)) {
proto_tree_add_item(st, hf_opcode, next_tvb, offset, 1, FALSE);
- last_opcode[pinfo->p2p_dir] = code;
+ if (pinfo->p2p_dir == P2P_DIR_SENT || pinfo->p2p_dir == P2P_DIR_RECV) {
+ last_opcode[pinfo->p2p_dir] = code;
+ }
}
else {
proto_tree_add_item(st, hf_response_code, next_tvb, offset, 1, FALSE);
diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c
index 950f2ff42b..868e9f728e 100644
--- a/epan/dissectors/packet-isakmp.c
+++ b/epan/dissectors/packet-isakmp.c
@@ -1767,6 +1767,10 @@ decrypt_payload(tvbuff_t *tvb, packet_info *pinfo, const guint8 *buf, guint buf_
if (decr->secret_len < gcry_cipher_get_algo_keylen(gcry_cipher_algo))
return NULL;
cbc_block_size = (guint32) gcry_cipher_get_algo_blklen(gcry_cipher_algo);
+ if (cbc_block_size > MAX_DIGEST_SIZE) {
+ /* This shouldn't happen but we pass cbc_block_size to memcpy size below. */
+ return NULL;
+ }
switch(decr->hash_alg) {
case HMAC_MD5:
diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c
index 0afdad6a9a..f76adcff6c 100644
--- a/epan/dissectors/packet-iwarp-mpa.c
+++ b/epan/dissectors/packet-iwarp-mpa.c
@@ -826,7 +826,7 @@ dissect_iwarp_mpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Markers are used by either the Initiator or the Responder or both. */
- if (state->ini_exp_m_res || state->res_exp_m_ini) {
+ if ((state->ini_exp_m_res || state->res_exp_m_ini) && endpoint <= MPA_RESPONDER) {
/* find the TCP sequence number of the first FPDU */
if (!state->minfo[endpoint].valid) {
@@ -844,7 +844,7 @@ dissect_iwarp_mpa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
return FALSE;
/* removes Markers if any and prepares new tvbuff for next dissector */
- if (state->minfo[endpoint].valid
+ if (endpoint <= MPA_RESPONDER && state->minfo[endpoint].valid
&& number_of_markers(state, tcpinfo, endpoint) > 0) {
next_tvb = tvb_new_subset(remove_markers(tvb, pinfo,
get_first_marker_offset(state, tcpinfo, endpoint),
diff --git a/epan/dissectors/packet-mount.c b/epan/dissectors/packet-mount.c
index 2414d02fc6..a6774427f2 100644
--- a/epan/dissectors/packet-mount.c
+++ b/epan/dissectors/packet-mount.c
@@ -270,7 +270,7 @@ dissect_group(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tre
group_name_list+group_names_len);
if((group_names_len>=(MAX_GROUP_NAME_LIST-5))||(str_len<0)){
g_snprintf(group_name_list+(MAX_GROUP_NAME_LIST-5), 5, "...");
- group_names_len=MAX_GROUP_NAME_LIST;
+ group_names_len=MAX_GROUP_NAME_LIST - 1;
} else {
group_names_len+=str_len;
group_name_list[group_names_len++]=' ';