summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-srvloc.c
diff options
context:
space:
mode:
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++;