aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-srvloc.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2016-07-16 13:06:28 -0400
committerMichael Mann <mmann78@netscape.net>2016-07-17 01:47:46 +0000
commit8cd167a06cdba22f4b1efeb8929228d387ea5f23 (patch)
tree92453da8e5b139d1783fad4ab9362dc8ada2c88f /epan/dissectors/packet-srvloc.c
parent379c3c6fde8a35648b570e714fc8b2ea7eead22e (diff)
Fix sscanf VS Code Analysis warnings.
Some needed to check return value, others were converted to use strtoul. Change-Id: I55aae216f95362b67e006f6e682abbd5ae2c8dcc Reviewed-on: https://code.wireshark.org/review/16502 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-srvloc.c')
-rw-r--r--epan/dissectors/packet-srvloc.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c
index b16c8c0c39..df8c467340 100644
--- a/epan/dissectors/packet-srvloc.c
+++ b/epan/dissectors/packet-srvloc.c
@@ -585,30 +585,26 @@ attr_list(proto_tree *tree, packet_info* pinfo, int hf, tvbuff_t *tvb, int offse
}
if (svc == 50) {
byte_value = unicode_to_bytes(tvb, foffset, 16, TRUE); /* IP Address */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
proto_tree_add_ipv4(srvloc_tree, hf_srvloc_add_ref_ip, tvb, foffset+2, 16, prot);
byte_value = unicode_to_bytes(tvb, foffset+18, 8, FALSE); /* Port */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
ti = proto_tree_add_uint(srvloc_tree, hf_srvloc_port, tvb, foffset+18, 4, prot);
proto_item_set_len(ti, 8);
}
else
{
byte_value = unicode_to_bytes(tvb, foffset+2, 16, FALSE); /* IPX Network Address */
- prot = 0;
+ prot = (guint32)strtoul(byte_value, NULL, 16);
sscanf(byte_value,"%x",&prot);
ti = proto_tree_add_uint(srvloc_tree, hf_srvloc_network, tvb, foffset+2, 4, prot);
proto_item_set_len(ti, 16);
byte_value = unicode_to_bytes(tvb, foffset+18, 24, FALSE); /* IPX Node Address */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
ti = proto_tree_add_uint(srvloc_tree, hf_srvloc_node, tvb, foffset+18, 4, prot);
proto_item_set_len(ti, 24);
byte_value = unicode_to_bytes(tvb, foffset+42, 8, FALSE); /* Socket */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
ti = proto_tree_add_uint(srvloc_tree, hf_srvloc_socket, tvb, foffset+42, 4, prot);
proto_item_set_len(ti, 8);
}
@@ -661,29 +657,24 @@ attr_list(proto_tree *tree, packet_info* pinfo, int hf, tvbuff_t *tvb, int offse
}
if (svc == 50) {
byte_value = unicode_to_bytes(tvb, foffset, 8, TRUE); /* IP Address */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
proto_tree_add_ipv4(srvloc_tree, hf_srvloc_add_ref_ip, tvb, foffset+1, 8, prot);
byte_value = unicode_to_bytes(tvb, foffset+9, 4, FALSE); /* Port */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
proto_tree_add_uint(srvloc_tree, hf_srvloc_port, tvb, foffset+9, 4, prot);
}
else
{
byte_value = unicode_to_bytes(tvb, foffset+1, 8, FALSE); /* IPX Network Address */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
ti = proto_tree_add_uint(srvloc_tree, hf_srvloc_network, tvb, foffset+1, 4, prot);
proto_item_set_len(ti, 8);
byte_value = unicode_to_bytes(tvb, foffset+9, 12, FALSE); /* IPX Node Address */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
ti = proto_tree_add_uint(srvloc_tree, hf_srvloc_node, tvb, foffset+9, 4, prot);
proto_item_set_len(ti, 12);
byte_value = unicode_to_bytes(tvb, foffset+21, 4, FALSE); /* Socket */
- prot = 0;
- sscanf(byte_value,"%x",&prot);
+ prot = (guint32)strtoul(byte_value, NULL, 16);
proto_tree_add_uint(srvloc_tree, hf_srvloc_socket, tvb, foffset+21, 4, prot);
}
i++;