if (ctx_tree) {
proto_item *iface_item;
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
if_id.Data1, if_id.Data2, if_id.Data3,
if_id.Data4[0], if_id.Data4[1],
if_id.Data4[4], if_id.Data4[5],
if_id.Data4[6], if_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
#ifdef _WIN32
if(ResolveWin32UUID(if_id, UUID_NAME, MAX_PATH))
/* XXX - use "dissect_ndr_uuid_t()"? */
dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &trans_id);
if (iface_tree) {
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
trans_id.Data1, trans_id.Data2, trans_id.Data3,
trans_id.Data4[0], trans_id.Data4[1],
trans_id.Data4[2], trans_id.Data4[3],
trans_id.Data4[4], trans_id.Data4[5],
trans_id.Data4[6], trans_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (iface_tree, hf_dcerpc_cn_bind_trans_id, tvb,
offset, 16, uuid_str, "Transfer Syntax: %s", uuid_str);
/* XXX - use "dissect_ndr_uuid_t()"? */
dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &trans_id);
if (dcerpc_tree) {
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
trans_id.Data1, trans_id.Data2, trans_id.Data3,
trans_id.Data4[0], trans_id.Data4[1],
trans_id.Data4[2], trans_id.Data4[3],
trans_id.Data4[4], trans_id.Data4[5],
trans_id.Data4[6], trans_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (dcerpc_tree, hf_dcerpc_cn_ack_trans_id, tvb,
offset, 16, uuid_str, "Transfer Syntax: %s", uuid_str);
/* XXX - use "dissect_ndr_uuid_t()"? */
dcerpc_tvb_get_uuid (tvb, offset, hdr->drep, &obj_id);
if (dcerpc_tree) {
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
obj_id.Data1, obj_id.Data2, obj_id.Data3,
obj_id.Data4[0],
obj_id.Data4[5],
obj_id.Data4[6],
obj_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (dcerpc_tree, hf_dcerpc_obj_id, tvb,
offset, 16, uuid_str, "Object UUID: %s", uuid_str);
if (tree) {
/* XXX - use "dissect_ndr_uuid_t()"? */
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
hdr.obj_id.Data1, hdr.obj_id.Data2, hdr.obj_id.Data3,
hdr.obj_id.Data4[0],
hdr.obj_id.Data4[5],
hdr.obj_id.Data4[6],
hdr.obj_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (dcerpc_tree, hf_dcerpc_obj_id, tvb,
offset, 16, uuid_str, "Object UUID: %s", uuid_str);
if (tree) {
/* XXX - use "dissect_ndr_uuid_t()"? */
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
hdr.if_id.Data1, hdr.if_id.Data2, hdr.if_id.Data3,
hdr.if_id.Data4[0],
hdr.if_id.Data4[5],
hdr.if_id.Data4[6],
hdr.if_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (dcerpc_tree, hf_dcerpc_dg_if_id, tvb,
offset, 16, uuid_str, "Interface: %s", uuid_str);
if (tree) {
/* XXX - use "dissect_ndr_uuid_t()"? */
- uuid_str_len = snprintf(uuid_str, DCERPC_UUID_STR_LEN,
+ uuid_str_len = g_snprintf(uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
hdr.act_id.Data1, hdr.act_id.Data2, hdr.act_id.Data3,
hdr.act_id.Data4[0],
hdr.act_id.Data4[5],
hdr.act_id.Data4[6],
hdr.act_id.Data4[7]);
- if (uuid_str_len >= DCERPC_UUID_STR_LEN)
+ if (uuid_str_len == -1 || uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
proto_tree_add_string_format (dcerpc_tree, hf_dcerpc_dg_act_id, tvb,
offset, 16, uuid_str, "Activity: %s", uuid_str);
#include <string.h>
#include <memory.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <glib.h>
#include <epan/ipv6-utils.h>
#include <epan/packet.h>
label_len = (bit_count - 1) / 8 + 1;
if (maxname > 0) {
- print_len = snprintf(np, maxname + 1, "\\[x");
+ print_len = g_snprintf(np, maxname + 1, "\\[x");
if (print_len != -1 && print_len <= maxname) {
- /* Some versions of snprintf return -1 if they'd truncate
+ /* Some versions of g_snprintf return -1 if they'd truncate
the output. Others return <buf_size> or greater. */
np += print_len;
maxname -= print_len;
}
while(label_len--) {
if (maxname > 0) {
- print_len = snprintf(np, maxname + 1, "%02x",
+ print_len = g_snprintf(np, maxname + 1, "%02x",
tvb_get_guint8(tvb, offset));
if (print_len != -1 && print_len <= maxname) {
- /* Some versions of snprintf return -1 if they'd truncate
+ /* Some versions of g_snprintf return -1 if they'd truncate
the output. Others return <buf_size> or greater. */
np += print_len;
maxname -= print_len;
offset++;
}
if (maxname > 0) {
- print_len = snprintf(np, maxname + 1, "/%d]", bit_count);
+ print_len = g_snprintf(np, maxname + 1, "/%d]", bit_count);
if (print_len != -1 && print_len <= maxname) {
- /* Some versions of snprintf return -1 if they'd truncate
+ /* Some versions of g_snprintf return -1 if they'd truncate
the output. Others return <buf_size> or greater. */
np += print_len;
maxname -= print_len;
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "packet-ipv6.h"
#include "packet-dns.h"
break;
}
if (i == 1)
- l = snprintf(p, ep - p, ",%d", s + off);
+ l = g_snprintf(p, ep - p, ",%d", s + off);
else {
- l = snprintf(p, ep - p, ",%d-%d", s + off,
+ l = g_snprintf(p, ep - p, ",%d-%d", s + off,
s + off + i - 1);
}
if (l == -1 || l > ep - p) {
char typebuf[256], codebuf[256];
if (coltypename && strcmp(coltypename, "Unknown") == 0) {
- snprintf(typebuf, sizeof(typebuf), "Unknown (0x%02x)",
+ g_snprintf(typebuf, sizeof(typebuf), "Unknown (0x%02x)",
dp->icmp6_type);
coltypename = typebuf;
}
if (colcodename && strcmp(colcodename, "Unknown") == 0) {
- snprintf(codebuf, sizeof(codebuf), "Unknown (0x%02x)",
+ g_snprintf(codebuf, sizeof(codebuf), "Unknown (0x%02x)",
dp->icmp6_code);
colcodename = codebuf;
}
/* Wi-Fi Protected Access (WPA) Information Element */
if (tag_val_off + 6 <= tag_len && !memcmp(tag_val, WPA_OUI"\x01", 4)) {
- snprintf(out_buff, SHORT_STR, "WPA IE, type %u, version %u",
+ g_snprintf(out_buff, SHORT_STR, "WPA IE, type %u, version %u",
tag_val[tag_val_off + 3], pletohs(&tag_val[tag_val_off + 4]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 6, out_buff);
offset += 6;
if (tag_val_off + 4 <= tag_len) {
/* multicast cipher suite */
if (!memcmp(&tag_val[tag_val_off], WPA_OUI, 3)) {
- snprintf(out_buff, SHORT_STR, "Multicast cipher suite: %s",
+ g_snprintf(out_buff, SHORT_STR, "Multicast cipher suite: %s",
wpa_cipher_idx2str(tag_val[tag_val_off + 3]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
tag_val_off += 4;
/* unicast cipher suites */
if (tag_val_off + 2 <= tag_len) {
- snprintf(out_buff, SHORT_STR, "# of unicast cipher suites: %u",
+ g_snprintf(out_buff, SHORT_STR, "# of unicast cipher suites: %u",
pletohs(tag_val + tag_val_off));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
i = 1;
while (tag_val_off + 4 <= tag_len) {
if (!memcmp(&tag_val[tag_val_off], WPA_OUI, 3)) {
- snprintf(out_buff, SHORT_STR, "Unicast cipher suite %u: %s",
+ g_snprintf(out_buff, SHORT_STR, "Unicast cipher suite %u: %s",
i, wpa_cipher_idx2str(tag_val[tag_val_off + 3]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
}
/* authenticated key management suites */
if (tag_val_off + 2 <= tag_len) {
- snprintf(out_buff, SHORT_STR, "# of auth key management suites: %u",
+ g_snprintf(out_buff, SHORT_STR, "# of auth key management suites: %u",
pletohs(tag_val + tag_val_off));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
i = 1;
while (tag_val_off + 4 <= tag_len) {
if (!memcmp(&tag_val[tag_val_off], WPA_OUI, 3)) {
- snprintf(out_buff, SHORT_STR, "auth key management suite %u: %s",
+ g_snprintf(out_buff, SHORT_STR, "auth key management suite %u: %s",
i, wpa_keymgmt_idx2str(tag_val[tag_val_off + 3]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
offset, tag_len - tag_val_off, "Not interpreted");
} else if (tag_val_off + 7 <= tag_len && !memcmp(tag_val, WME_OUI"\x02\x00", 5)) {
/* Wireless Multimedia Enhancements (WME) Information Element */
- snprintf(out_buff, SHORT_STR, "WME IE: type %u, subtype %u, version %u, parameter set %u",
+ g_snprintf(out_buff, SHORT_STR, "WME IE: type %u, subtype %u, version %u, parameter set %u",
tag_val[tag_val_off + 3], tag_val[tag_val_off + 4], tag_val[tag_val_off + 5],
tag_val[tag_val_off + 6]);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 7, out_buff);
} else if (tag_val_off + 24 <= tag_len && !memcmp(tag_val, WME_OUI"\x02\x01", 5)) {
/* Wireless Multimedia Enhancements (WME) Parameter Element */
- snprintf(out_buff, SHORT_STR, "WME PE: type %u, subtype %u, version %u, parameter set %u",
+ g_snprintf(out_buff, SHORT_STR, "WME PE: type %u, subtype %u, version %u, parameter set %u",
tag_val[tag_val_off + 3], tag_val[tag_val_off + 4], tag_val[tag_val_off + 5],
tag_val[tag_val_off + 6]);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 7, out_buff);
offset += 8;
tag_val_off += 8;
for (i = 0; i < 4; i++) {
- snprintf(out_buff, SHORT_STR, "WME AC Parameters: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
+ g_snprintf(out_buff, SHORT_STR, "WME AC Parameters: ACI %u (%s), Admission Control %sMandatory, AIFSN %u, ECWmin %u, ECWmax %u, TXOP %u",
(tag_val[tag_val_off] & 0x60) >> 5,
wme_acs[(tag_val[tag_val_off] & 0x60) >> 5],
(tag_val[tag_val_off] & 0x10) ? "" : "not ",
};
const char *field;
- snprintf(out_buff, SHORT_STR, "WME TSPEC: type %u, subtype %u, version %u",
+ g_snprintf(out_buff, SHORT_STR, "WME TSPEC: type %u, subtype %u, version %u",
tag_val[tag_val_off + 3], tag_val[tag_val_off + 4], tag_val[tag_val_off + 5]);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 6, out_buff);
offset += 6;
tag_val_off += 6;
ts_info = tvb_get_letohs(tvb, offset);
- snprintf(out_buff, SHORT_STR, "WME TS Info: Priority %u (%s) (%s), Contention-based access %sset, %s",
+ g_snprintf(out_buff, SHORT_STR, "WME TS Info: Priority %u (%s) (%s), Contention-based access %sset, %s",
(ts_info >> 11) & 0x7, qos_tags[(ts_info >> 11) & 0x7], qos_acs[(ts_info >> 11) & 0x7],
(ts_info & 0x0080) ? "" : "not ",
direction[(ts_info >> 5) & 0x3]);
tag_val_off += 2;
msdu_size = tvb_get_letohs(tvb, offset);
- snprintf(out_buff, SHORT_STR, "WME TSPEC: %s MSDU Size %u",
+ g_snprintf(out_buff, SHORT_STR, "WME TSPEC: %s MSDU Size %u",
(msdu_size & 0x8000) ? "Fixed" : "Nominal", msdu_size & 0x7fff);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
tag_val_off += 2;
- snprintf(out_buff, SHORT_STR, "WME TSPEC: Maximum MSDU Size %u", tvb_get_letohs(tvb, offset));
+ g_snprintf(out_buff, SHORT_STR, "WME TSPEC: Maximum MSDU Size %u", tvb_get_letohs(tvb, offset));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
tag_val_off += 2;
while ((field = val_to_str(tag_val_off, fields, "Unknown"))) {
- snprintf(out_buff, SHORT_STR, "WME TSPEC: %s %u", field, tvb_get_letohl(tvb, offset));
+ g_snprintf(out_buff, SHORT_STR, "WME TSPEC: %s %u", field, tvb_get_letohl(tvb, offset));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
tag_val_off += 4;
}
surplus_bandwidth = tvb_get_letohs(tvb, offset);
- snprintf(out_buff, SHORT_STR, "WME TSPEC: Surplus Bandwidth Allowance Factor %u.%u",
+ g_snprintf(out_buff, SHORT_STR, "WME TSPEC: Surplus Bandwidth Allowance Factor %u.%u",
(surplus_bandwidth >> 13) & 0x7, (surplus_bandwidth & 0x1fff));
offset += 2;
tag_val_off += 2;
- snprintf(out_buff, SHORT_STR, "WME TSPEC: Medium Time %u", tvb_get_letohs(tvb, offset));
+ g_snprintf(out_buff, SHORT_STR, "WME TSPEC: Medium Time %u", tvb_get_letohs(tvb, offset));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
tag_val_off += 2;
return;
}
- snprintf(out_buff, SHORT_STR, "RSN IE, version %u",
+ g_snprintf(out_buff, SHORT_STR, "RSN IE, version %u",
pletohs(&tag_val[tag_val_off]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
/* multicast cipher suite */
if (!memcmp(&tag_val[tag_val_off], RSN_OUI, 3)) {
- snprintf(out_buff, SHORT_STR, "Multicast cipher suite: %s",
+ g_snprintf(out_buff, SHORT_STR, "Multicast cipher suite: %s",
wpa_cipher_idx2str(tag_val[tag_val_off + 3]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
/* unicast cipher suites */
count = pletohs(tag_val + tag_val_off);
- snprintf(out_buff, SHORT_STR, "# of unicast cipher suites: %u", count);
+ g_snprintf(out_buff, SHORT_STR, "# of unicast cipher suites: %u", count);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
tag_val_off += 2;
while (tag_val_off + 4 <= tag_len && i <= count) {
if (memcmp(&tag_val[tag_val_off], RSN_OUI, 3) != 0)
goto done;
- snprintf(out_buff, SHORT_STR, "Unicast cipher suite %u: %s",
+ g_snprintf(out_buff, SHORT_STR, "Unicast cipher suite %u: %s",
i, wpa_cipher_idx2str(tag_val[tag_val_off + 3]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
/* authenticated key management suites */
count = pletohs(tag_val + tag_val_off);
- snprintf(out_buff, SHORT_STR, "# of auth key management suites: %u", count);
+ g_snprintf(out_buff, SHORT_STR, "# of auth key management suites: %u", count);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
tag_val_off += 2;
while (tag_val_off + 4 <= tag_len && i <= count) {
if (memcmp(&tag_val[tag_val_off], RSN_OUI, 3) != 0)
goto done;
- snprintf(out_buff, SHORT_STR, "auth key management suite %u: %s",
+ g_snprintf(out_buff, SHORT_STR, "auth key management suite %u: %s",
i, wpa_keymgmt_idx2str(tag_val[tag_val_off + 3]));
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 4, out_buff);
offset += 4;
goto done;
rsn_capab = pletohs(&tag_val[tag_val_off]);
- snprintf(out_buff, SHORT_STR, "RSN Capabilities 0x%04x", rsn_capab);
+ g_snprintf(out_buff, SHORT_STR, "RSN Capabilities 0x%04x", rsn_capab);
cap_item = proto_tree_add_uint_format(tree, rsn_cap, tvb,
offset, 2, rsn_capab,
"RSN Capabilities: 0x%04X", rsn_capab);
goto done;
count = pletohs(tag_val + tag_val_off);
- snprintf(out_buff, SHORT_STR, "# of PMKIDs: %u", count);
+ g_snprintf(out_buff, SHORT_STR, "# of PMKIDs: %u", count);
proto_tree_add_string(tree, tag_interpretation, tvb, offset, 2, out_buff);
offset += 2;
tag_val_off += 2;
}
n += ret;
}
- snprintf (out_buff, SHORT_STR, "Supported rates: %s [Mbit/sec]", print_buff);
+ g_snprintf (out_buff, SHORT_STR, "Supported rates: %s [Mbit/sec]", print_buff);
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
tag_len, out_buff);
tag_len);
break;
}
- snprintf (out_buff, SHORT_STR,
+ g_snprintf (out_buff, SHORT_STR,
"Dwell time 0x%04X, Hop Set %2d, Hop Pattern %2d, Hop Index %2d",
tvb_get_letohs(tvb, offset + 2),
tvb_get_guint8(tvb, offset + 4),
tag_len);
break;
}
- snprintf (out_buff, SHORT_STR, "Current Channel: %u",
+ g_snprintf (out_buff, SHORT_STR, "Current Channel: %u",
tvb_get_guint8(tvb, offset + 2));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
tag_len);
break;
}
- snprintf (out_buff, SHORT_STR, "CFP count: %u",
+ g_snprintf (out_buff, SHORT_STR, "CFP count: %u",
tvb_get_guint8(tvb, offset + 2));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string_format(tree, tag_interpretation, tvb, offset + 2,
1, out_buff, "%s", out_buff);
- snprintf (out_buff, SHORT_STR, "CFP period: %u",
+ g_snprintf (out_buff, SHORT_STR, "CFP period: %u",
tvb_get_guint8(tvb, offset + 3));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string_format(tree, tag_interpretation, tvb, offset + 3,
1, out_buff, "%s", out_buff);
- snprintf (out_buff, SHORT_STR, "CFP max duration: %u",
+ g_snprintf (out_buff, SHORT_STR, "CFP max duration: %u",
tvb_get_letohs(tvb, offset + 4));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string_format(tree, tag_interpretation, tvb, offset + 4,
2, out_buff, "%s", out_buff);
- snprintf (out_buff, SHORT_STR, "CFP Remaining: %u",
+ g_snprintf (out_buff, SHORT_STR, "CFP Remaining: %u",
tvb_get_letohs(tvb, offset + 6));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string_format(tree, tag_interpretation, tvb, offset + 6,
tag_len);
break;
}
- snprintf (out_buff, SHORT_STR, "ATIM window 0x%X",
+ g_snprintf (out_buff, SHORT_STR, "ATIM window 0x%X",
tvb_get_letohs(tvb, offset + 2));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
}
tvb_memcpy(tvb, ccode, offset + 2, 2);
ccode[2] = '\0';
- snprintf (out_buff, SHORT_STR, "Country Code: %s, %s Environment",
+ g_snprintf (out_buff, SHORT_STR, "Country Code: %s, %s Environment",
format_text(ccode, 2),
val_to_str(tvb_get_guint8(tvb, offset + 4), environment_vals,"Unknown (0x%02x)"));
out_buff[SHORT_STR-1] = '\0';
tag_len);
break;
}
- snprintf (out_buff, SHORT_STR, "Prime Radix: %u, Number of Channels: %u",
+ g_snprintf (out_buff, SHORT_STR, "Prime Radix: %u, Number of Channels: %u",
tvb_get_guint8(tvb, offset + 2),
tvb_get_guint8(tvb, offset + 3));
out_buff[SHORT_STR-1] = '\0';
break;
case TAG_CHALLENGE_TEXT:
- snprintf (out_buff, SHORT_STR, "Challenge text: %s",
+ g_snprintf (out_buff, SHORT_STR, "Challenge text: %s",
tvb_bytes_to_str(tvb, offset + 2, tag_len));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
break;
}
erp_info = tvb_get_guint8 (tvb, offset + 2);
- snprintf (print_buff, SHORT_STR, "%sNon-ERP STAs, %suse protection, %s preambles",
+ g_snprintf (print_buff, SHORT_STR, "%sNon-ERP STAs, %suse protection, %s preambles",
erp_info & 0x01 ? "" : "no ",
erp_info & 0x02 ? "" : "do not ",
erp_info & 0x04 ? "short or long": "long");
print_buff[SHORT_STR-1] = '\0';
- snprintf (out_buff, SHORT_STR,
+ g_snprintf (out_buff, SHORT_STR,
"ERP info: 0x%x (%s)",erp_info,print_buff);
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
tag_len);
break;
}
- snprintf (out_buff, SHORT_STR, "%.16s",
+ g_snprintf (out_buff, SHORT_STR, "%.16s",
tvb_format_stringzpad(tvb, offset + 12, 16));
out_buff[SHORT_STR-1] = '\0';
proto_tree_add_string_format (tree, tag_interpretation, tvb, offset + 2,
* determined to be possible only with one of the encryption protocols.
*/
if (tvb_get_guint8(tvb, hdr_len + 1) & 0x20) {
- snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
+ g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
tvb_get_letohl(tvb, hdr_len + 4),
tvb_get_guint8(tvb, hdr_len),
tvb_get_guint8(tvb, hdr_len + 2));
EXTIV_LEN, out_buff);
}
if (tvb_get_guint8(tvb, hdr_len + 2) == 0) {
- snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
+ g_snprintf(out_buff, SHORT_STR, "0x%08X%02X%02X",
tvb_get_letohl(tvb, hdr_len + 4),
tvb_get_guint8(tvb, hdr_len + 1),
tvb_get_guint8(tvb, hdr_len));
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/ipv6-utils.h>
#include <epan/ipproto.h>
int ret;
if (type & SIT_IDENTITY) {
- ret = snprintf(msg, SIT_MSG_NUM-n, "%sIDENTITY", sep);
+ ret = g_snprintf(msg, SIT_MSG_NUM-n, "%sIDENTITY", sep);
if (ret == -1 || ret >= SIT_MSG_NUM-n) {
/* Truncated. */
msg[SIT_MSG_NUM-1] = '\0';
/* No more room. */
return msg;
}
- ret = snprintf(msg, SIT_MSG_NUM-n, "%sSECRECY", sep);
+ ret = g_snprintf(msg, SIT_MSG_NUM-n, "%sSECRECY", sep);
if (ret == -1 || ret >= SIT_MSG_NUM-n) {
/* Truncated. */
msg[SIT_MSG_NUM-1] = '\0';
/* No more room. */
return msg;
}
- ret = snprintf(msg, SIT_MSG_NUM-n, "%sINTEGRITY", sep);
+ ret = g_snprintf(msg, SIT_MSG_NUM-n, "%sINTEGRITY", sep);
if (ret == -1 || ret >= SIT_MSG_NUM-n) {
/* Truncated. */
msg[SIT_MSG_NUM-1] = '\0';
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/ipproto.h>
#include <epan/afn.h>
case 1008: /* Query Object ID is GUID plus unknown data */ {
e_uuid_t fs_id;
char uuid_str[DCERPC_UUID_STR_LEN];
- int uuid_str_len;
guint8 drep = 0x10;
CHECK_BYTE_COUNT_TRANS_SUBR(16);
dcerpc_tvb_get_uuid (tvb, offset, &drep, &fs_id);
- uuid_str_len = snprintf(
+ g_snprintf(
uuid_str, DCERPC_UUID_STR_LEN,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
fs_id.Data1, fs_id.Data2, fs_id.Data3,
#include <glib.h>
#include <float.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "packet.h"
#include "strutil.h"
#include "addr_resolv.h"
switch(hfinfo->type) {
case FT_NONE:
case FT_PROTOCOL:
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s", hfinfo->name);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
case FT_UINT_BYTES:
bytes = fvalue_get(&fi->value);
if (bytes) {
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", hfinfo->name,
bytes_to_str(bytes, fvalue_length(&fi->value)));
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
}
else {
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: <MISSING>", hfinfo->name);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
break;
case FT_FLOAT:
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %." STRINGIFY(FLT_DIG) "f",
hfinfo->name, fvalue_get_floating(&fi->value));
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
break;
case FT_DOUBLE:
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %." STRINGIFY(DBL_DIG) "g",
hfinfo->name, fvalue_get_floating(&fi->value));
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
break;
case FT_ABSOLUTE_TIME:
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", hfinfo->name,
abs_time_to_str(fvalue_get(&fi->value)));
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
break;
case FT_RELATIVE_TIME:
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s seconds", hfinfo->name,
rel_time_to_secs_str(fvalue_get(&fi->value)));
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
case FT_IPXNET:
integer = fvalue_get_integer(&fi->value);
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s (0x%08X)", hfinfo->name,
get_ipxnet_name(integer), integer);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
case FT_ETHER:
bytes = fvalue_get(&fi->value);
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s (%s)", hfinfo->name,
get_ether_name(bytes),
ether_to_str(bytes));
case FT_IPv4:
ipv4 = fvalue_get(&fi->value);
n_addr = ipv4_get_net_order_addr(ipv4);
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s (%s)", hfinfo->name,
get_hostname(n_addr),
ip_to_str((guint8*)&n_addr));
case FT_IPv6:
bytes = fvalue_get(&fi->value);
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s (%s)", hfinfo->name,
get_hostname6((struct e_in6_addr *)bytes),
ip6_to_str((struct e_in6_addr*)bytes));
case FT_GUID:
bytes = fvalue_get(&fi->value);
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", hfinfo->name,
guid_to_str(bytes));
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
case FT_UINT_STRING:
bytes = fvalue_get(&fi->value);
if(strlen(bytes) > ITEM_LABEL_LENGTH) {
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s [truncated]: %s", hfinfo->name,
format_text(bytes, strlen(bytes)));
} else {
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
"%s: %s", hfinfo->name,
format_text(bytes, strlen(bytes)));
}
}
/* Fill in the textual info */
- ret = snprintf(p, ITEM_LABEL_LENGTH - bitfield_byte_length,
+ ret = g_snprintf(p, ITEM_LABEL_LENGTH - bitfield_byte_length,
"%s: %s", hfinfo->name,
value ? tfstring->true_string : tfstring->false_string);
if ((ret == -1) || (ret >= (ITEM_LABEL_LENGTH - bitfield_byte_length)))
bitfield_byte_length = p - label_str;
/* Fill in the textual info using stored (shifted) value */
- ret = snprintf(p, ITEM_LABEL_LENGTH - bitfield_byte_length,
+ ret = g_snprintf(p, ITEM_LABEL_LENGTH - bitfield_byte_length,
format, hfinfo->name,
val_to_str(value, cVALS(hfinfo->strings), "Unknown"), value);
if ((ret == -1) || (ret >= (ITEM_LABEL_LENGTH - bitfield_byte_length)))
bitfield_byte_length = p - label_str;
/* Fill in the textual info using stored (shifted) value */
- ret = snprintf(p, ITEM_LABEL_LENGTH - bitfield_byte_length,
+ ret = g_snprintf(p, ITEM_LABEL_LENGTH - bitfield_byte_length,
format, hfinfo->name, value);
if ((ret == -1) || (ret >= (ITEM_LABEL_LENGTH - bitfield_byte_length)))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
value = fvalue_get_integer(&fi->value);
/* Fill in the textual info */
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
format, hfinfo->name,
val_to_str(value, cVALS(hfinfo->strings), "Unknown"), value);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
value = fvalue_get_integer(&fi->value);
/* Fill in the textual info */
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
format, hfinfo->name, value);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
value = fvalue_get_integer64(&fi->value);
/* Fill in the textual info */
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
format, hfinfo->name, value);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
value = fvalue_get_integer(&fi->value);
/* Fill in the textual info */
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
format, hfinfo->name,
val_to_str(value, cVALS(hfinfo->strings), "Unknown"), value);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
value = fvalue_get_integer(&fi->value);
/* Fill in the textual info */
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
format, hfinfo->name, value);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
value = fvalue_get_integer64(&fi->value);
/* Fill in the textual info */
- ret = snprintf(label_str, ITEM_LABEL_LENGTH,
+ ret = g_snprintf(label_str, ITEM_LABEL_LENGTH,
format, hfinfo->name, value);
if ((ret == -1) || (ret >= ITEM_LABEL_LENGTH))
label_str[ITEM_LABEL_LENGTH - 1] = '\0';
dfilter_len = abbrev_len + 4 + 11 + 1;
buf = g_malloc0(dfilter_len);
format = hfinfo_numeric_format(hfinfo);
- snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer(&finfo->value));
+ g_snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer(&finfo->value));
break;
case FT_INT64:
dfilter_len = abbrev_len + 4 + 22 + 1;
buf = g_malloc0(dfilter_len);
format = hfinfo_numeric_format(hfinfo);
- snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer64(&finfo->value));
+ g_snprintf(buf, dfilter_len, format, hfinfo->abbrev, fvalue_get_integer64(&finfo->value));
break;
case FT_IPXNET:
*/
dfilter_len = abbrev_len + 4 + 2 + 8 + 1;
buf = g_malloc0(dfilter_len);
- snprintf(buf, dfilter_len, "%s == 0x%08x", hfinfo->abbrev,
+ g_snprintf(buf, dfilter_len, "%s == 0x%08x", hfinfo->abbrev,
fvalue_get_integer(&finfo->value));
break;
stringified = ip6_to_str((struct e_in6_addr*) fvalue_get(&finfo->value));
dfilter_len = abbrev_len + 4 + strlen(stringified) + 1;
buf = g_malloc0(dfilter_len);
- snprintf(buf, dfilter_len, "%s == %s", hfinfo->abbrev,
+ g_snprintf(buf, dfilter_len, "%s == %s", hfinfo->abbrev,
stringified);
break;
buf = g_malloc0(dfilter_len);
/* Create the string */
- snprintf(buf, dfilter_len, "%s == ", hfinfo->abbrev);
+ g_snprintf(buf, dfilter_len, "%s == ", hfinfo->abbrev);
fvalue_to_string_repr(&finfo->value,
FTREPR_DFILTER,
&buf[abbrev_len + 4]);
* no more than bufsize number of bytes, including terminating NUL, to buffer.
* Returns length of string (not including terminating NUL), or -1 if the string was
* truncated in the buffer due to not having reached the terminating NUL.
- * In this way, it acts like snprintf().
+ * In this way, it acts like g_snprintf().
*
* bufsize MUST be greater than 0.
*
* no more than bufsize number of bytes, including terminating NUL, to buffer.
* Returns length of string (not including terminating NUL), or -1 if the string was
* truncated in the buffer due to not having reached the terminating NUL.
- * In this way, it acts like snprintf().
+ * In this way, it acts like g_snprintf().
*
* When processing a packet where the remaining number of bytes is less
* than bufsize, an exception is not thrown if the end of the packet
* no more than bufsize number of bytes, including terminating NUL, to buffer.
* Returns length of string (not including terminating NUL), or -1 if the string was
* truncated in the buffer due to not having reached the terminating NUL.
- * In this way, it acts like snprintf().
+ * In this way, it acts like g_snprintf().
*
* When processing a packet where the remaining number of bytes is less
* than bufsize, an exception is not thrown if the end of the packet
if (maxname > 0) {
- print_len = snprintf(np, maxname + 1, "\\[x");
- if (print_len != -1) {
- /* Some versions of snprintf return -1 if they'd truncate
+ print_len = g_snprintf(np, maxname + 1, "\\[x");
+ if (print_len != -1 && print_len < maxname + 1) {
+ /* Some versions of g_snprintf return -1 if they'd truncate
the output. */
np += print_len;
maxname -= print_len;
}
while(label_len--) {
if (maxname > 0) {
- print_len = snprintf(np, maxname + 1, "%02x",
+ print_len = g_snprintf(np, maxname + 1, "%02x",
tvb_get_guint8(tvb, offset));
- if (print_len != -1) {
- /* Some versions of snprintf return -1 if they'd truncate
+ if (print_len != -1 && print_len < maxname + 1) {
+ /* Some versions of g_snprintf return -1 if they'd truncate
the output. */
np += print_len;
maxname -= print_len;
offset++;
}
if (maxname > 0) {
- print_len = snprintf(np, maxname + 1, "/%d]", bit_count);
- if (print_len != -1) {
- /* Some versions of snprintf return -1 if they'd truncate
+ print_len = g_snprintf(np, maxname + 1, "/%d]", bit_count);
+ if (print_len != -1 && print_len < maxname + 1) {
+ /* Some versions of g_snprintf return -1 if they'd truncate
the output. */
np += print_len;
maxname -= print_len;