aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--capture_sync.c52
-rw-r--r--disabled_protos.c3
-rw-r--r--epan/addr_resolv.c14
-rw-r--r--epan/asn1.c6
-rw-r--r--epan/atalk-utils.c6
-rw-r--r--epan/atalk-utils.h2
-rw-r--r--epan/column-utils.c72
-rw-r--r--epan/dfilter/dfilter.c4
-rw-r--r--epan/dissectors/packet-afp.c4
-rw-r--r--epan/dissectors/packet-amr.c4
-rw-r--r--epan/dissectors/packet-aoe.c4
-rw-r--r--epan/dissectors/packet-ber.c3
-rw-r--r--epan/dissectors/packet-bgp.c8
-rw-r--r--epan/dissectors/packet-brdwlk.c4
-rw-r--r--epan/dissectors/packet-bssgp.c13
-rw-r--r--epan/dissectors/packet-camel.c4
-rw-r--r--epan/dissectors/packet-ccsds.c4
-rw-r--r--epan/dissectors/packet-cip.c4
-rw-r--r--epan/dissectors/packet-cpfi.c4
-rw-r--r--epan/dissectors/packet-cpha.c4
-rw-r--r--epan/dissectors/packet-csm-encaps.c4
-rw-r--r--epan/dissectors/packet-dcerpc-samr.c12
-rw-r--r--epan/dissectors/packet-dcerpc.c4
-rw-r--r--epan/dissectors/packet-dcm.c14
-rw-r--r--epan/dissectors/packet-dcom.c2
-rw-r--r--epan/dissectors/packet-diameter.c12
-rw-r--r--epan/dissectors/packet-dnp.c8
-rw-r--r--epan/dissectors/packet-dns.c6
-rw-r--r--epan/dissectors/packet-enip.c4
-rw-r--r--epan/dissectors/packet-fc.c4
-rw-r--r--epan/dissectors/packet-fcct.c4
-rw-r--r--epan/dissectors/packet-fcdns.c4
-rw-r--r--epan/dissectors/packet-fcels.c4
-rw-r--r--epan/dissectors/packet-fcfcs.c4
-rw-r--r--epan/dissectors/packet-fcfzs.c4
-rw-r--r--epan/dissectors/packet-fclctl.c4
-rw-r--r--epan/dissectors/packet-fcp.c4
-rw-r--r--epan/dissectors/packet-fcsb3.c4
-rw-r--r--epan/dissectors/packet-fcsp.c4
-rw-r--r--epan/dissectors/packet-fcswils.c4
-rw-r--r--epan/dissectors/packet-g723.c4
-rw-r--r--epan/dissectors/packet-gprs-llc.c4
-rw-r--r--epan/dissectors/packet-hyperscsi.c4
-rw-r--r--epan/dissectors/packet-ieee80211.c2
-rw-r--r--epan/dissectors/packet-igmp.c6
-rw-r--r--epan/dissectors/packet-image-gif.c4
-rw-r--r--epan/dissectors/packet-image-jfif.c4
-rw-r--r--epan/dissectors/packet-ipdc.c4
-rw-r--r--epan/dissectors/packet-ipv6.c2
-rw-r--r--epan/dissectors/packet-ipvs-syncd.c4
-rw-r--r--epan/dissectors/packet-ismp.c4
-rw-r--r--epan/dissectors/packet-isns.c4
-rw-r--r--epan/dissectors/packet-isup.c4
-rw-r--r--epan/dissectors/packet-isup_thin.c4
-rw-r--r--epan/dissectors/packet-jxta.c8
-rw-r--r--epan/dissectors/packet-kerberos.c2
-rw-r--r--epan/dissectors/packet-laplink.c4
-rw-r--r--epan/dissectors/packet-ldap.c6
-rw-r--r--epan/dissectors/packet-lwapp.c4
-rw-r--r--epan/dissectors/packet-mdshdr.c4
-rw-r--r--epan/dissectors/packet-msrp.c4
-rw-r--r--epan/dissectors/packet-mtp3.c4
-rw-r--r--epan/dissectors/packet-mtp3mg.c6
-rw-r--r--epan/dissectors/packet-multipart.c4
-rw-r--r--epan/dissectors/packet-ntp.c8
-rw-r--r--epan/dissectors/packet-pflog.c4
-rw-r--r--epan/dissectors/packet-pim.c18
-rw-r--r--epan/dissectors/packet-pn-rt.c4
-rw-r--r--epan/dissectors/packet-ptp.c4
-rw-r--r--epan/dissectors/packet-rsvp.c20
-rw-r--r--epan/dissectors/packet-rtps.c4
-rw-r--r--epan/dissectors/packet-sccp.c6
-rw-r--r--epan/dissectors/packet-sccpmg.c6
-rw-r--r--epan/dissectors/packet-sebek.c4
-rw-r--r--epan/dissectors/packet-sflow.c4
-rw-r--r--epan/dissectors/packet-sigcomp.c4
-rw-r--r--epan/dissectors/packet-sndcp.c4
-rw-r--r--epan/dissectors/packet-stun.c4
-rw-r--r--epan/dissectors/packet-uma.c4
-rw-r--r--epan/dissectors/packet-wccp.c8
-rw-r--r--epan/dissectors/packet-wsp.c4
-rw-r--r--epan/dissectors/packet-wtls.c12
-rw-r--r--epan/dissectors/packet-wtp.c4
-rw-r--r--epan/filesystem.c41
-rw-r--r--epan/follow.c7
-rw-r--r--epan/inet_ntop.c10
-rw-r--r--epan/ipproto.c6
-rw-r--r--epan/plugins.c8
-rw-r--r--epan/proto.c3
-rw-r--r--epan/sigcomp-udvm.c4
-rw-r--r--epan/sigcomp_state_hdlr.c4
-rw-r--r--epan/to_str.c32
-rw-r--r--epan/to_str.h2
-rw-r--r--epan/value_string.c5
-rw-r--r--filters.c3
-rw-r--r--pcap-util-unix.c9
-rw-r--r--plugins/asn1/packet-asn1.c44
-rw-r--r--plugins/ciscosm/packet-sm.c4
-rw-r--r--plugins/docsis/packet-vendor.c4
-rw-r--r--plugins/irda/packet-ircomm.c3
-rw-r--r--plugins/irda/packet-irda.c8
-rw-r--r--plugins/opsi/packet-opsi.c4
-rw-r--r--plugins/rlm/packet-rlm.c4
-rw-r--r--plugins/v5ua/packet-v5ua.c4
-rw-r--r--ringbuffer.c6
-rw-r--r--tap-iousers.c48
-rw-r--r--tap-rpcprogs.c2
-rw-r--r--tethereal.c54
-rw-r--r--util.c6
109 files changed, 258 insertions, 622 deletions
diff --git a/capture_sync.c b/capture_sync.c
index 1d1750b09f..083a9f2669 100644
--- a/capture_sync.c
+++ b/capture_sync.c
@@ -303,21 +303,6 @@ sync_pipe_add_arg(const char **args, int *argc, const char *arg)
return args;
}
-#ifdef _WIN32
-/* Given a string, return a pointer to a quote-encapsulated version of
- the string, so we can pass it as an argument with "spawnvp" even
- if it contains blanks. */
-char *
-sync_pipe_quote_encapsulate(const char *string)
-{
- char *encapsulated_string;
-
- encapsulated_string = g_new(char, strlen(string) + 3);
- sprintf(encapsulated_string, "\"%s\"", string);
- return encapsulated_string;
-}
-#endif
-
#define ARGV_NUMBER_LEN 24
@@ -370,17 +355,17 @@ sync_pipe_start(capture_options *capture_opts) {
if (capture_opts->has_snaplen) {
argv = sync_pipe_add_arg(argv, &argc, "-s");
- sprintf(ssnap,"%d",capture_opts->snaplen);
+ g_snprintf(ssnap, ARGV_NUMBER_LEN, "%d",capture_opts->snaplen);
argv = sync_pipe_add_arg(argv, &argc, ssnap);
}
if (capture_opts->linktype != -1) {
argv = sync_pipe_add_arg(argv, &argc, "-y");
#ifdef HAVE_PCAP_DATALINK_VAL_TO_NAME
- sprintf(ssnap,"%s",pcap_datalink_val_to_name(capture_opts->linktype));
+ g_snprintf(ssnap, ARGV_NUMBER_LEN, "%s",pcap_datalink_val_to_name(capture_opts->linktype));
#else
/* XXX - just treat it as a number */
- sprintf(ssnap,"%d",capture_opts->linktype);
+ g_snprintf(ssnap, ARGV_NUMBER_LEN, "%d",capture_opts->linktype);
#endif
argv = sync_pipe_add_arg(argv, &argc, ssnap);
}
@@ -388,44 +373,44 @@ sync_pipe_start(capture_options *capture_opts) {
if(capture_opts->multi_files_on) {
if (capture_opts->has_autostop_filesize) {
argv = sync_pipe_add_arg(argv, &argc, "-b");
- sprintf(sfilesize,"filesize:%d",capture_opts->autostop_filesize);
+ g_snprintf(sfilesize, ARGV_NUMBER_LEN, "filesize:%d",capture_opts->autostop_filesize);
argv = sync_pipe_add_arg(argv, &argc, sfilesize);
}
if (capture_opts->has_file_duration) {
argv = sync_pipe_add_arg(argv, &argc, "-b");
- sprintf(sfile_duration,"duration:%d",capture_opts->file_duration);
+ g_snprintf(sfile_duration, ARGV_NUMBER_LEN, "duration:%d",capture_opts->file_duration);
argv = sync_pipe_add_arg(argv, &argc, sfile_duration);
}
if (capture_opts->has_ring_num_files) {
argv = sync_pipe_add_arg(argv, &argc, "-b");
- sprintf(sring_num_files,"files:%d",capture_opts->ring_num_files);
+ g_snprintf(sring_num_files, ARGV_NUMBER_LEN, "files:%d",capture_opts->ring_num_files);
argv = sync_pipe_add_arg(argv, &argc, sring_num_files);
}
if (capture_opts->has_autostop_files) {
argv = sync_pipe_add_arg(argv, &argc, "-a");
- sprintf(sautostop_files,"files:%d",capture_opts->autostop_files);
+ g_snprintf(sautostop_files, ARGV_NUMBER_LEN, "files:%d",capture_opts->autostop_files);
argv = sync_pipe_add_arg(argv, &argc, sautostop_files);
}
} else {
if (capture_opts->has_autostop_filesize) {
argv = sync_pipe_add_arg(argv, &argc, "-a");
- sprintf(sautostop_filesize,"filesize:%d",capture_opts->autostop_filesize);
+ g_snprintf(sautostop_filesize, ARGV_NUMBER_LEN, "filesize:%d",capture_opts->autostop_filesize);
argv = sync_pipe_add_arg(argv, &argc, sautostop_filesize);
}
}
if (capture_opts->has_autostop_packets) {
argv = sync_pipe_add_arg(argv, &argc, "-c");
- sprintf(scount,"%d",capture_opts->autostop_packets);
+ g_snprintf(scount, ARGV_NUMBER_LEN, "%d",capture_opts->autostop_packets);
argv = sync_pipe_add_arg(argv, &argc, scount);
}
if (capture_opts->has_autostop_duration) {
argv = sync_pipe_add_arg(argv, &argc, "-a");
- sprintf(sautostop_duration,"duration:%d",capture_opts->autostop_duration);
+ g_snprintf(sautostop_duration, ARGV_NUMBER_LEN, "duration:%d",capture_opts->autostop_duration);
argv = sync_pipe_add_arg(argv, &argc, sautostop_duration);
}
@@ -461,29 +446,29 @@ sync_pipe_start(capture_options *capture_opts) {
capture_opts->signal_pipe_fd = signal_pipe[PIPE_WRITE];
argv = sync_pipe_add_arg(argv, &argc, "-B");
- sprintf(buffer_size,"%d",capture_opts->buffer_size);
+ g_snprintf(buffer_size, ARGV_NUMBER_LEN, "%d",capture_opts->buffer_size);
argv = sync_pipe_add_arg(argv, &argc, buffer_size);
/* Convert font name to a quote-encapsulated string and pass to child */
argv = sync_pipe_add_arg(argv, &argc, "-m");
- fontstring = sync_pipe_quote_encapsulate(prefs.PREFS_GUI_FONT_NAME);
+ fontstring = g_strdup_printf("\"%s\"", prefs.PREFS_GUI_FONT_NAME);
argv = sync_pipe_add_arg(argv, &argc, fontstring);
/* Convert sync pipe write handle to a string and pass to child */
argv = sync_pipe_add_arg(argv, &argc, "-Z");
- sprintf(sync_pipe_fd,"sync:%d",sync_pipe[PIPE_WRITE]);
+ g_snprintf(sync_pipe_fd, ARGV_NUMBER_LEN, "sync:%d",sync_pipe[PIPE_WRITE]);
argv = sync_pipe_add_arg(argv, &argc, sync_pipe_fd);
/* Convert signal pipe read handle to a string and pass to child */
argv = sync_pipe_add_arg(argv, &argc, "-Z");
- sprintf(signal_pipe_fd,"signal:%d",signal_pipe[PIPE_READ]);
+ g_snprintf(signal_pipe_fd, ARGV_NUMBER_LEN, "signal:%d",signal_pipe[PIPE_READ]);
argv = sync_pipe_add_arg(argv, &argc, signal_pipe_fd);
/* Convert filter string to a quote delimited string and pass to child */
filterstring = NULL;
if (capture_opts->cfilter != NULL && strlen(capture_opts->cfilter) != 0) {
argv = sync_pipe_add_arg(argv, &argc, "-f");
- filterstring = sync_pipe_quote_encapsulate(capture_opts->cfilter);
+ filterstring = g_strdup_printf("\"%s\"", capture_opts->cfilter);
argv = sync_pipe_add_arg(argv, &argc, filterstring);
}
@@ -491,7 +476,7 @@ sync_pipe_start(capture_options *capture_opts) {
savefilestring = NULL;
if(capture_opts->save_file) {
argv = sync_pipe_add_arg(argv, &argc, "-w");
- savefilestring = sync_pipe_quote_encapsulate(capture_opts->save_file);
+ savefilestring = g_strdup_printf("\"%s\"", capture_opts->save_file);
argv = sync_pipe_add_arg(argv, &argc, savefilestring);
}
@@ -547,7 +532,7 @@ sync_pipe_start(capture_options *capture_opts) {
dup(sync_pipe[PIPE_WRITE]);
close(sync_pipe[PIPE_READ]);
execvp(ethereal_path, argv);
- snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
+ g_snprintf(errmsg, sizeof errmsg, "Couldn't run %s in child process: %s",
ethereal_path, strerror(errno));
sync_pipe_errmsg_to_parent(errmsg);
@@ -812,7 +797,8 @@ sync_pipe_signame(int sig)
break;
default:
- sprintf(sigmsg_buf, "Signal %d", sig);
+ /* XXX - returning a static buffer is ok in the context we use it here */
+ g_snprintf(sigmsg_buf, sizeof sigmsg_buf, "Signal %d", sig);
sigmsg = sigmsg_buf;
break;
}
diff --git a/disabled_protos.c b/disabled_protos.c
index 19045431db..d8fbdf11b8 100644
--- a/disabled_protos.c
+++ b/disabled_protos.c
@@ -333,8 +333,7 @@ save_disabled_protos_list(char **pref_path_return, int *errno_return)
/* Write to "XXX.new", and rename if that succeeds.
That means we don't trash the file if we fail to write it out
completely. */
- ff_path_new = (gchar *) g_malloc(strlen(ff_path) + 5);
- sprintf(ff_path_new, "%s.new", ff_path);
+ ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = fopen(ff_path_new, "w")) == NULL) {
*pref_path_return = ff_path;
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index 32e83cf427..7700ec80f4 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -1413,9 +1413,7 @@ static void initialize_ipxnets(void)
* directory as well?
*/
if (g_ipxnets_path == NULL) {
- g_ipxnets_path = g_malloc(strlen(get_systemfile_dir()) +
- strlen(ENAME_IPXNETS) + 2);
- sprintf(g_ipxnets_path, "%s" G_DIR_SEPARATOR_S "%s",
+ g_ipxnets_path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
get_systemfile_dir(), ENAME_IPXNETS);
}
@@ -1698,7 +1696,7 @@ host_name_lookup_process(gpointer data _U_) {
almsg = (adns_queue_msg_t *) cur->data;
if (! almsg->submitted && almsg->type == AF_INET) {
addr_bytes = (guint8 *) &almsg->ip4_addr;
- sprintf(addr_str, "%u.%u.%u.%u.in-addr.arpa.", addr_bytes[3],
+ g_snprintf(addr_str, sizeof addr_str, "%u.%u.%u.%u.in-addr.arpa.", addr_bytes[3],
addr_bytes[2], addr_bytes[1], addr_bytes[0]);
/* XXX - what if it fails? */
adns_submit (ads, addr_str, adns_r_ptr, 0, NULL, &almsg->query);
@@ -1881,7 +1879,7 @@ extern gchar *get_udp_port(guint port)
} else {
cur = &str[0][0];
}
- sprintf(cur, "%u", port);
+ g_snprintf(cur, MAXNAMELEN, "%u", port);
return cur;
}
@@ -1902,7 +1900,7 @@ extern gchar *get_tcp_port(guint port)
} else {
cur = &str[0][0];
}
- sprintf(cur, "%u", port);
+ g_snprintf(cur, MAXNAMELEN, "%u", port);
return cur;
}
@@ -1923,7 +1921,7 @@ extern gchar *get_sctp_port(guint port)
} else {
cur = &str[0][0];
}
- sprintf(cur, "%u", port);
+ g_snprintf(cur, MAXNAMELEN, "%u", port);
return cur;
}
@@ -2125,7 +2123,7 @@ extern const gchar *get_manuf_name(const guint8 *addr)
} else {
cur = &str[0][0];
}
- sprintf(cur, "%02x:%02x:%02x", addr[0], addr[1], addr[2]);
+ g_snprintf(cur, MAXMANUFLEN, "%02x:%02x:%02x", addr[0], addr[1], addr[2]);
return cur;
}
diff --git a/epan/asn1.c b/epan/asn1.c
index d3d9fc02f3..5d118479aa 100644
--- a/epan/asn1.c
+++ b/epan/asn1.c
@@ -66,10 +66,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/tvbuff.h>
#include <epan/asn1.h>
@@ -1077,7 +1073,7 @@ asn1_err_to_str(int err)
break;
default:
- snprintf(errstrbuf, sizeof errstrbuf, "Unknown error (%d)", err);
+ g_snprintf(errstrbuf, sizeof errstrbuf, "Unknown error (%d)", err);
errstr = errstrbuf;
break;
}
diff --git a/epan/atalk-utils.c b/epan/atalk-utils.c
index 07a6471526..2d79be137d 100644
--- a/epan/atalk-utils.c
+++ b/epan/atalk-utils.c
@@ -39,12 +39,12 @@ atalk_addr_to_str(const struct atalk_ddp_addr *addrp)
} else {
cur = &str[0][0];
}
- atalk_addr_to_str_buf(addrp, cur);
+ atalk_addr_to_str_buf(addrp, cur, 14);
return cur;
}
void
-atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp, gchar *buf)
+atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp, gchar *buf, int buf_len)
{
- sprintf(buf, "%u.%u", addrp->net, addrp->node );
+ g_snprintf(buf, buf_len, "%u.%u", addrp->net, addrp->node );
}
diff --git a/epan/atalk-utils.h b/epan/atalk-utils.h
index 74f5df263d..5eed8a2362 100644
--- a/epan/atalk-utils.h
+++ b/epan/atalk-utils.h
@@ -49,6 +49,6 @@ struct atalk_ddp_addr {
*/
extern gchar *atalk_addr_to_str(const struct atalk_ddp_addr *addrp);
extern void atalk_addr_to_str_buf(const struct atalk_ddp_addr *addrp,
- gchar *buf);
+ gchar *buf, int buf_len);
#endif
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 70f70055b5..14d7097707 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -29,10 +29,6 @@
#include <string.h>
#include <time.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "column-utils.h"
#include "timestamp.h"
#include "sna-utils.h"
@@ -480,7 +476,7 @@ col_set_abs_date_time(frame_data *fd, column_info *cinfo, int col)
then = fd->abs_secs;
tmp = localtime(&then);
if (tmp != NULL) {
- snprintf(cinfo->col_buf[col], COL_MAX_LEN,
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN,
"%04d-%02d-%02d %02d:%02d:%02d.%06ld",
tmp->tm_year + 1900,
tmp->tm_mon + 1,
@@ -528,7 +524,7 @@ col_set_abs_time(frame_data *fd, column_info *cinfo, int col)
then = fd->abs_secs;
tmp = localtime(&then);
if (tmp != NULL) {
- snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%06ld",
+ g_snprintf(cinfo->col_buf[col], COL_MAX_LEN, "%02d:%02d:%02d.%06ld",
tmp->tm_hour,
tmp->tm_min,
tmp->tm_sec,
@@ -596,7 +592,7 @@ col_set_addr(packet_info *pinfo, int col, address *addr, gboolean is_res,
break;
default:
- address_to_str_buf(addr, pinfo->cinfo->col_buf[col]);
+ address_to_str_buf(addr, pinfo->cinfo->col_buf[col], COL_MAX_LEN);
break;
}
}
@@ -669,19 +665,19 @@ col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
if (is_res)
strncpy(pinfo->cinfo->col_buf[col], get_sctp_port(port), COL_MAX_LEN);
else
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
break;
case PT_TCP:
if (is_res)
strncpy(pinfo->cinfo->col_buf[col], get_tcp_port(port), COL_MAX_LEN);
else
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
if (is_src)
strcpy(pinfo->cinfo->col_expr[col], "tcp.srcport");
else
strcpy(pinfo->cinfo->col_expr[col], "tcp.dstport");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
@@ -689,12 +685,12 @@ col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
if (is_res)
strncpy(pinfo->cinfo->col_buf[col], get_udp_port(port), COL_MAX_LEN);
else
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
if (is_src)
strcpy(pinfo->cinfo->col_expr[col], "udp.srcport");
else
strcpy(pinfo->cinfo->col_expr[col], "udp.dstport");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
@@ -703,30 +699,30 @@ col_set_port(packet_info *pinfo, int col, gboolean is_res, gboolean is_src)
strcpy(pinfo->cinfo->col_expr[col], "ddp.src_socket");
else
strcpy(pinfo->cinfo->col_expr[col], "ddp.dst_socket");
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", port);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", port);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
case PT_IPX:
/* XXX - resolve IPX socket numbers */
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
if (is_src)
strcpy(pinfo->cinfo->col_expr[col], "ipx.src.socket");
else
strcpy(pinfo->cinfo->col_expr[col], "ipx.dst.socket");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
case PT_IDP:
/* XXX - resolve IDP socket numbers */
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "0x%04x", port);
if (is_src)
strcpy(pinfo->cinfo->col_expr[col], "idp.src.socket");
else
strcpy(pinfo->cinfo->col_expr[col], "idp.dst.socket");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "0x%04x", port);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
@@ -784,28 +780,28 @@ col_set_circuit_id(packet_info *pinfo, int col)
switch (pinfo->ctype) {
case CT_DLCI:
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
strcpy(pinfo->cinfo->col_expr[col], "fr.dlci");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
case CT_ISDN:
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%s",
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%s",
val_to_str(pinfo->circuit_id, channel_vals, "Unknown (%u)"));
strcpy(pinfo->cinfo->col_expr[col], "isdn.channel");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
case CT_X25:
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
break;
case CT_ISUP:
- snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ g_snprintf(pinfo->cinfo->col_buf[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
strcpy(pinfo->cinfo->col_expr[col], "isup.cic");
- snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
+ g_snprintf(pinfo->cinfo->col_expr_val[col], COL_MAX_LEN, "%u", pinfo->circuit_id);
pinfo->cinfo->col_expr_val[col][COL_MAX_LEN - 1] = '\0';
break;
@@ -825,7 +821,7 @@ fill_in_columns(packet_info *pinfo)
switch (pinfo->cinfo->col_fmt[i]) {
case COL_NUMBER:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->num);
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
strcpy(pinfo->cinfo->col_expr[i], "frame.number");
strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
@@ -833,7 +829,7 @@ fill_in_columns(packet_info *pinfo)
case COL_CLS_TIME:
if(pinfo->fd->flags.ref_time){
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
} else {
col_set_cls_time(pinfo->fd, pinfo->cinfo, i);
@@ -842,7 +838,7 @@ fill_in_columns(packet_info *pinfo)
case COL_ABS_TIME:
if(pinfo->fd->flags.ref_time){
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
} else {
col_set_abs_time(pinfo->fd, pinfo->cinfo, i);
@@ -851,7 +847,7 @@ fill_in_columns(packet_info *pinfo)
case COL_ABS_DATE_TIME:
if(pinfo->fd->flags.ref_time){
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
} else {
col_set_abs_date_time(pinfo->fd, pinfo->cinfo, i);
@@ -860,7 +856,7 @@ fill_in_columns(packet_info *pinfo)
case COL_REL_TIME:
if(pinfo->fd->flags.ref_time){
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
} else {
col_set_rel_time(pinfo->fd, pinfo->cinfo, i);
@@ -869,7 +865,7 @@ fill_in_columns(packet_info *pinfo)
case COL_DELTA_TIME:
if(pinfo->fd->flags.ref_time){
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "*REF*");
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
} else {
col_set_delta_time(pinfo->fd, pinfo->cinfo, i);
@@ -953,25 +949,25 @@ fill_in_columns(packet_info *pinfo)
break;
case COL_PACKET_LENGTH:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->pkt_len);
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
strcpy(pinfo->cinfo->col_expr[i], "frame.pkt_len");
strcpy(pinfo->cinfo->col_expr_val[i], pinfo->cinfo->col_buf[i]);
break;
case COL_CUMULATIVE_BYTES:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->cum_bytes);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->fd->cum_bytes);
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
break;
case COL_OXID:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->oxid);
pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
break;
case COL_RXID:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->rxid);
pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
break;
@@ -984,19 +980,19 @@ fill_in_columns(packet_info *pinfo)
break;
case COL_SRCIDX:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->src_idx);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->src_idx);
pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
break;
case COL_DSTIDX:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->dst_idx);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "0x%x", pinfo->dst_idx);
pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
break;
case COL_VSAN:
- snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->vsan);
+ g_snprintf(pinfo->cinfo->col_buf[i], COL_MAX_LEN, "%u", pinfo->vsan);
pinfo->cinfo->col_buf[i][COL_MAX_LEN - 1] = '\0';
pinfo->cinfo->col_data[i] = pinfo->cinfo->col_buf[i];
break;
diff --git a/epan/dfilter/dfilter.c b/epan/dfilter/dfilter.c
index 1657562e44..aca1562a44 100644
--- a/epan/dfilter/dfilter.c
+++ b/epan/dfilter/dfilter.c
@@ -27,10 +27,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include "dfilter-int.h"
#include "syntax-tree.h"
#include "gencode.h"
diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c
index 96300383a1..8f95ea68a5 100644
--- a/epan/dissectors/packet-afp.c
+++ b/epan/dissectors/packet-afp.c
@@ -33,10 +33,6 @@
#include <stdio.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
diff --git a/epan/dissectors/packet-amr.c b/epan/dissectors/packet-amr.c
index a6bc974511..31fd1e8ac6 100644
--- a/epan/dissectors/packet-amr.c
+++ b/epan/dissectors/packet-amr.c
@@ -37,10 +37,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
diff --git a/epan/dissectors/packet-aoe.c b/epan/dissectors/packet-aoe.c
index 4605b7b1c3..e0cfd48d50 100644
--- a/epan/dissectors/packet-aoe.c
+++ b/epan/dissectors/packet-aoe.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include <etypes.h>
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 7a5bffb5a6..824129804d 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -1706,10 +1706,9 @@ dissect_ber_GeneralizedTime(gboolean implicit_tag, packet_info *pinfo, proto_tre
tmpstr=tvb_get_ptr(tvb, offset, len);
- snprintf(str, 31, "%.4s-%.2s-%.2s %.2s:%.2s:%.2s (%.1s)",
+ g_snprintf(str, 32, "%.4s-%.2s-%.2s %.2s:%.2s:%.2s (%.1s)",
tmpstr, tmpstr+4, tmpstr+6, tmpstr+8,
tmpstr+10, tmpstr+12, tmpstr+14);
- str[31]=0; /* just in case ... */
if(hf_id!=-1){
proto_tree_add_string(tree, hf_id, tvb, offset, len, str);
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c
index 6ca5173532..f1886c3f06 100644
--- a/epan/dissectors/packet-bgp.c
+++ b/epan/dissectors/packet-bgp.c
@@ -51,10 +51,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/addr_and_mask.h>
#include "packet-bgp.h"
@@ -481,11 +477,11 @@ decode_MPLS_stack(tvbuff_t *tvb, gint offset, char *buf, size_t buflen)
/* withdrawn routes may contain 0 or 0x800000 in the first label */
if((index-offset)==0&&(label_entry==0||label_entry==0x800000)) {
- snprintf(buf, buflen, "0 (withdrawn)");
+ g_snprintf(buf, buflen, "0 (withdrawn)");
return (1);
}
- snprintf(junk_buf, sizeof(junk_buf),"%u%s", (label_entry >> 4), ((label_entry & 0x000001) == 0) ? "," : " (bottom)");
+ g_snprintf(junk_buf, sizeof(junk_buf),"%u%s", (label_entry >> 4), ((label_entry & 0x000001) == 0) ? "," : " (bottom)");
if (strlen(buf) + strlen(junk_buf) + 1 <= buflen)
strcat(buf, junk_buf);
index += 3 ;
diff --git a/epan/dissectors/packet-brdwlk.c b/epan/dissectors/packet-brdwlk.c
index 1fce4130d8..10545e8e53 100644
--- a/epan/dissectors/packet-brdwlk.c
+++ b/epan/dissectors/packet-brdwlk.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-bssgp.c b/epan/dissectors/packet-bssgp.c
index 38a11acac9..7505215ccc 100644
--- a/epan/dissectors/packet-bssgp.c
+++ b/epan/dissectors/packet-bssgp.c
@@ -4124,16 +4124,7 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) {
}
if (use_default_ie_name) {
- ie->name = g_malloc(strlen(iename) + 1);
- if (ie->name == NULL) {
-#ifdef BSSGP_DEBUG
- proto_tree_add_text(bi->bssgp_tree, bi->tvb, bi->offset, 1,
- "Out of memory");
-#endif
- /* Out of memory */
- exit(EXIT_FAILURE);
- }
- strcpy(ie->name, iename);
+ ie->name = g_strdup(iename);
}
switch (ie->iei) {
@@ -4345,7 +4336,7 @@ decode_ie(bssgp_ie_t *ie, build_info_t *bi) {
}
if (use_default_ie_name) {
/* Memory has been allocated; free it */
- g_free(ie->name);
+ g_free( (gpointer) ie->name);
ie->name = NULL;
}
}
diff --git a/epan/dissectors/packet-camel.c b/epan/dissectors/packet-camel.c
index e2d1ebebc9..bfa51ca1ee 100644
--- a/epan/dissectors/packet-camel.c
+++ b/epan/dissectors/packet-camel.c
@@ -3161,7 +3161,7 @@ dissect_camel_DateAndTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
guint8 digit_pair;
guint8 i = 0, curr_offset;
- char *time = (char *)(calloc (2*7 + 5 + 1, sizeof(char)));
+ char *time = (char *)(g_malloc0 ( (2*7 + 5 + 1) * sizeof(char)));
char c[ 2*7 + 5] = ""; /*temporary container*/
time[ 2*7 + 5 +1 ] = '\0';
@@ -3234,7 +3234,7 @@ dissect_camel_DateAndTime(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset,
0,
7,
time);
- free (time);
+ g_free (time);
return 7; /* 7 octetes eaten*/
diff --git a/epan/dissectors/packet-ccsds.c b/epan/dissectors/packet-ccsds.c
index ac1f6ca281..cc9fc8a245 100644
--- a/epan/dissectors/packet-ccsds.c
+++ b/epan/dissectors/packet-ccsds.c
@@ -33,10 +33,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/*
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c
index 76278f4db4..21b9451027 100644
--- a/epan/dissectors/packet-cip.c
+++ b/epan/dissectors/packet-cip.c
@@ -37,10 +37,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <prefs.h>
#include "packet-tcp.h"
diff --git a/epan/dissectors/packet-cpfi.c b/epan/dissectors/packet-cpfi.c
index e1b22ca7d2..7f28e1abcb 100644
--- a/epan/dissectors/packet-cpfi.c
+++ b/epan/dissectors/packet-cpfi.c
@@ -194,7 +194,7 @@ dissect_cpfi_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
src_board = tda >> 4;
src_port = tda & 0x0f;
src = (1 << 24) + (src_instance << 16) + (src_board << 8) + src_port;
- snprintf(src_str, sizeof(src_str), "%u.%u.%u", src_instance, src_board, src_port);
+ g_snprintf(src_str, sizeof(src_str), "%u.%u.%u", src_instance, src_board, src_port);
}
/* Figure out where the frame is going. srcTDA is destination of frame! */
@@ -210,7 +210,7 @@ dissect_cpfi_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dst_board = tda >> 4;
dst_port = tda & 0x0f;
dst = (1 << 24) + (dst_instance << 16) + (dst_board << 8) + dst_port;
- snprintf(dst_str, sizeof(dst_str), "%u.%u.%u", dst_instance, dst_board, dst_port);
+ g_snprintf(dst_str, sizeof(dst_str), "%u.%u.%u", dst_instance, dst_board, dst_port);
}
/* Set up the source and destination and arrow per user configuration. */
diff --git a/epan/dissectors/packet-cpha.c b/epan/dissectors/packet-cpha.c
index 6ce650c535..bcba0774d3 100644
--- a/epan/dissectors/packet-cpha.c
+++ b/epan/dissectors/packet-cpha.c
@@ -32,10 +32,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/ipproto.h>
diff --git a/epan/dissectors/packet-csm-encaps.c b/epan/dissectors/packet-csm-encaps.c
index 73c2bb03fc..a459d95c20 100644
--- a/epan/dissectors/packet-csm-encaps.c
+++ b/epan/dissectors/packet-csm-encaps.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
diff --git a/epan/dissectors/packet-dcerpc-samr.c b/epan/dissectors/packet-dcerpc-samr.c
index 4fe262b113..4527455675 100644
--- a/epan/dissectors/packet-dcerpc-samr.c
+++ b/epan/dissectors/packet-dcerpc-samr.c
@@ -40,10 +40,6 @@
#include "packet-windows-common.h"
#include "packet-smb-common.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
static int proto_dcerpc_samr = -1;
static int hf_samr_opnum = -1;
@@ -2793,7 +2789,7 @@ samr_dissect_INDEX_ARRAY(tvbuff_t *tvb, int offset,
di=pinfo->private_data;
field_name = proto_registrar_get_name(di->hf_index);
- snprintf(str, 255, "INDEX_ARRAY: %s%s:", field_name,
+ g_snprintf(str, 255, "INDEX_ARRAY: %s%s:", field_name,
plural_ending(field_name));
if(parent_tree){
item = proto_tree_add_text(parent_tree, tvb, offset, -1,
@@ -2854,7 +2850,7 @@ samr_dissect_IDX_AND_NAME(tvbuff_t *tvb, int offset,
di=pinfo->private_data;
- snprintf(str, 255, "IDX_AND_NAME: %s:",proto_registrar_get_name(di->hf_index));
+ g_snprintf(str, 255, "IDX_AND_NAME: %s:",proto_registrar_get_name(di->hf_index));
if(parent_tree){
item = proto_tree_add_text(parent_tree, tvb, offset, -1,
"%s",str);
@@ -2909,7 +2905,7 @@ samr_dissect_IDX_AND_NAME_ARRAY(tvbuff_t *tvb, int offset,
offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
hf_samr_count, &count);
- snprintf(str, 255, "IDX_AND_NAME pointer: %s%s:", field_name,
+ g_snprintf(str, 255, "IDX_AND_NAME pointer: %s%s:", field_name,
plural_ending(field_name));
offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
samr_dissect_IDX_AND_NAME_entry, NDR_POINTER_UNIQUE,
@@ -2931,7 +2927,7 @@ samr_dissect_IDX_AND_NAME_ARRAY_ptr(tvbuff_t *tvb, int offset,
di=pinfo->private_data;
field_name = proto_registrar_get_name(di->hf_index);
- snprintf(str, 255, "IDX_AND_NAME_ARRAY pointer: %s%s:", field_name,
+ g_snprintf(str, 255, "IDX_AND_NAME_ARRAY pointer: %s%s:", field_name,
plural_ending(field_name));
offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
samr_dissect_IDX_AND_NAME_ARRAY, NDR_POINTER_UNIQUE,
diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c
index e5d1b62649..f47caaa73f 100644
--- a/epan/dissectors/packet-dcerpc.c
+++ b/epan/dissectors/packet-dcerpc.c
@@ -456,7 +456,7 @@ int ResolveWin32UUID(e_uuid_t if_id, char *UUID_NAME, int UUID_NAME_MAX_LEN)
if(UUID_NAME_MAX_LEN < 2)
return 0;
REG_UUID_NAME[0] = '\0';
- snprintf(REG_UUID_STR, MAX_PATH, "SOFTWARE\\Classes\\Interface\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ g_snprintf(REG_UUID_STR, MAX_PATH, "SOFTWARE\\Classes\\Interface\\{%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[2], if_id.Data4[3],
@@ -466,7 +466,7 @@ int ResolveWin32UUID(e_uuid_t if_id, char *UUID_NAME, int UUID_NAME_MAX_LEN)
{
if (RegQueryValueEx(hKey, NULL, NULL, NULL, (LPBYTE)REG_UUID_NAME, &UUID_MAX_SIZE) == ERROR_SUCCESS && UUID_MAX_SIZE <= MAX_PATH)
{
- snprintf(UUID_NAME, UUID_NAME_MAX_LEN, "%s", REG_UUID_NAME);
+ g_snprintf(UUID_NAME, UUID_NAME_MAX_LEN, "%s", REG_UUID_NAME);
RegCloseKey(hKey);
return strlen(REG_UUID_NAME);
}
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c
index a846332068..95ed785941 100644
--- a/epan/dissectors/packet-dcm.c
+++ b/epan/dissectors/packet-dcm.c
@@ -101,10 +101,6 @@
#include "isprint.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/conversation.h>
@@ -530,7 +526,7 @@ dcm_tag2str(guint16 grp, guint16 elm, guint8 syntax, tvbuff_t *tvb, int offset,
if (DCM_ILE & syntax)
val32 = tvb_get_letohl(tvb, offset);
else val32 = tvb_get_ntohl(tvb, offset);
- snprintf(buf, sizeof(buf), "Group Length 0x%x (%d)", val32, val32);
+ g_snprintf(buf, sizeof(buf), "Group Length 0x%x (%d)", val32, val32);
return buf;
}
tag = (grp << 16) | elm;
@@ -1042,14 +1038,14 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb_memcpy(tvb, dcm_data->targ, 26, 16);
dcm_data->orig[AEEND] = dcm_data->targ[AEEND] = 0;
buf = g_malloc(128);
- snprintf(buf, 128, "DCM ASSOC Request %s <-- %s",
+ g_snprintf(buf, 128, "DCM ASSOC Request %s <-- %s",
dcm_data->orig, dcm_data->targ);
offset = 74;
break;
case 2: /* ASSOC Accept */
tvb_memcpy(tvb, dcm_data->resp, 26, 16);
buf = g_malloc(128);
- snprintf(buf, 128, "DCM ASSOC Accept %s <-- %s (%s)",
+ g_snprintf(buf, 128, "DCM ASSOC Accept %s <-- %s (%s)",
dcm_data->orig, dcm_data->targ, dcm_data->resp);
offset = 74;
break;
@@ -1058,7 +1054,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dcm_data->source = tvb_get_guint8(tvb, 8);
dcm_data->reason = tvb_get_guint8(tvb, 9);
buf = g_malloc(128);
- snprintf(buf, 128, "DCM ASSOC Reject %s <-- %s %s %s %s",
+ g_snprintf(buf, 128, "DCM ASSOC Reject %s <-- %s %s %s %s",
dcm_data->orig, dcm_data->targ,
dcm_result2str(dcm_data->result),
dcm_source2str(dcm_data->source),
@@ -1084,7 +1080,7 @@ dissect_dcm_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
dcm_data->source = tvb_get_guint8(tvb, 8);
dcm_data->reason = tvb_get_guint8(tvb, 9);
buf = g_malloc(128);
- snprintf(buf, 128, "DCM ABORT %s <-- %s %s %s",
+ g_snprintf(buf, 128, "DCM ABORT %s <-- %s %s %s",
dcm_data->orig, dcm_data->targ,
(dcm_data->source == 1) ? "USER" :
(dcm_data->source == 2) ? "PROVIDER" : "",
diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c
index 33623ed8c7..b64d1150c4 100644
--- a/epan/dissectors/packet-dcom.c
+++ b/epan/dissectors/packet-dcom.c
@@ -675,7 +675,7 @@ const gchar* dcom_uuid_to_str(e_uuid_t *uuid) {
} else {
cur = &str[0][0];
}
- snprintf(cur, 64, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ g_snprintf(cur, 64, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
uuid->Data1, uuid->Data2, uuid->Data3,
uuid->Data4[0], uuid->Data4[1],
uuid->Data4[2], uuid->Data4[3],
diff --git a/epan/dissectors/packet-diameter.c b/epan/dissectors/packet-diameter.c
index 20f6eeb3ae..0853412b8e 100644
--- a/epan/dissectors/packet-diameter.c
+++ b/epan/dissectors/packet-diameter.c
@@ -57,10 +57,6 @@
#include "packet-tcp.h"
#include "packet-sip.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
/* This must be defined before we include packet-diameter-defs.h */
/* Valid data types */
@@ -923,7 +919,7 @@ diameter_vendor_to_str(guint32 vendorId, gboolean longName) {
}
}
- snprintf(buffer, sizeof(buffer),
+ g_snprintf(buffer, sizeof(buffer),
"Vendor 0x%08x", vendorId);
return buffer;
} /*diameter_vendor_to_str */
@@ -965,7 +961,7 @@ diameter_command_to_str(guint32 commandCode, guint32 vendorId)
if ( suppress_console_output == FALSE )
g_warning("Diameter: Unable to find name for command code 0x%08x, Vendor \"%u\"!",
commandCode, vendorId);
- snprintf(buffer, sizeof(buffer),
+ g_snprintf(buffer, sizeof(buffer),
"Cmd-0x%08x", commandCode);
break;
case DIAMETER_RFC:
@@ -980,7 +976,7 @@ diameter_command_to_str(guint32 commandCode, guint32 vendorId)
if ( suppress_console_output == FALSE )
g_warning("Diameter: Unable to find name for command code 0x%08x!",
commandCode);
- snprintf(buffer, sizeof(buffer),
+ g_snprintf(buffer, sizeof(buffer),
"Cmd-0x%08x", commandCode);
break;
}
@@ -999,7 +995,7 @@ diameter_app_to_str(guint32 appId) {
}
}
- snprintf(buffer, sizeof(buffer), "Unknown");
+ g_snprintf(buffer, sizeof(buffer), "Unknown");
return buffer;
} /*diameter_app_to_str */
diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c
index f0c433b65d..f962129dc3 100644
--- a/epan/dissectors/packet-dnp.c
+++ b/epan/dissectors/packet-dnp.c
@@ -37,10 +37,6 @@
#include <glib.h>
#include <time.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
@@ -1124,10 +1120,10 @@ dnp3_al_decode_timestamp(tvbuff_t *tvb, int temp_pos, char* buff)
alts_noms = (const long) al_timestamp;
ptm = gmtime(&alts_noms);
- /*snprintf(buff, 25,"%02d/%02d/%4d %02d:%02d:%02d.%03d",(ptm->tm_mon + 1), ptm->tm_mday,
+ /*g_snprintf(buff, 25,"%02d/%02d/%4d %02d:%02d:%02d.%03d",(ptm->tm_mon + 1), ptm->tm_mday,
(ptm->tm_year+1900), ptm->tm_hour, ptm->tm_min, ptm->tm_sec, time_ms); */
/* Time-stamp in ISO format - perhaps an option should be added for different locales? */
- snprintf(buff, 25,"%04d/%02d/%02d %02d:%02d:%02d.%03"PRIu64,(ptm->tm_year+1900),ptm->tm_mday,
+ g_snprintf(buff, 25,"%04d/%02d/%02d %02d:%02d:%02d.%03"PRIu64,(ptm->tm_year+1900),ptm->tm_mday,
(ptm->tm_mon + 1), ptm->tm_hour, ptm->tm_min, ptm->tm_sec, time_ms);
diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c
index 12333373e3..f0788d3d68 100644
--- a/epan/dissectors/packet-dns.c
+++ b/epan/dissectors/packet-dns.c
@@ -443,7 +443,7 @@ dns_type_description (guint type)
short_name = dns_type_name(type);
if (short_name == NULL) {
- snprintf(strbuf, sizeof strbuf, "Unknown (%u)", type);
+ g_snprintf(strbuf, sizeof strbuf, "Unknown (%u)", type);
return strbuf;
}
if (type < sizeof(type_names)/sizeof(type_names[0]))
@@ -482,9 +482,9 @@ dns_type_description (guint type)
}
if (long_name != NULL)
- snprintf(strbuf, sizeof strbuf, "%s (%s)", short_name, long_name);
+ g_snprintf(strbuf, sizeof strbuf, "%s (%s)", short_name, long_name);
else
- snprintf(strbuf, sizeof strbuf, "%s", short_name);
+ g_snprintf(strbuf, sizeof strbuf, "%s", short_name);
return strbuf;
}
diff --git a/epan/dissectors/packet-enip.c b/epan/dissectors/packet-enip.c
index 3a0ede14a2..9c7a89c0ac 100644
--- a/epan/dissectors/packet-enip.c
+++ b/epan/dissectors/packet-enip.c
@@ -37,10 +37,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <prefs.h>
#include "packet-tcp.h"
diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c
index efab45c62c..7ab8cf9d3f 100644
--- a/epan/dissectors/packet-fc.c
+++ b/epan/dissectors/packet-fc.c
@@ -44,10 +44,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
diff --git a/epan/dissectors/packet-fcct.c b/epan/dissectors/packet-fcct.c
index 269edacd97..d938c8fe16 100644
--- a/epan/dissectors/packet-fcct.c
+++ b/epan/dissectors/packet-fcct.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "etypes.h"
#include "packet-fc.h"
diff --git a/epan/dissectors/packet-fcdns.c b/epan/dissectors/packet-fcdns.c
index f3765350d1..ce9cbf0dce 100644
--- a/epan/dissectors/packet-fcdns.c
+++ b/epan/dissectors/packet-fcdns.c
@@ -47,10 +47,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-fcels.c b/epan/dissectors/packet-fcels.c
index b576ee0a4a..54964ab1f0 100644
--- a/epan/dissectors/packet-fcels.c
+++ b/epan/dissectors/packet-fcels.c
@@ -46,10 +46,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-fcfcs.c b/epan/dissectors/packet-fcfcs.c
index 30f30e018a..a974bf12e8 100644
--- a/epan/dissectors/packet-fcfcs.c
+++ b/epan/dissectors/packet-fcfcs.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-fcfzs.c b/epan/dissectors/packet-fcfzs.c
index 90afbfc6ac..b1284726f2 100644
--- a/epan/dissectors/packet-fcfzs.c
+++ b/epan/dissectors/packet-fcfzs.c
@@ -47,10 +47,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-fclctl.c b/epan/dissectors/packet-fclctl.c
index 446585c424..f635c17f4d 100644
--- a/epan/dissectors/packet-fclctl.c
+++ b/epan/dissectors/packet-fclctl.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "etypes.h"
#include "packet-fc.h"
diff --git a/epan/dissectors/packet-fcp.c b/epan/dissectors/packet-fcp.c
index 247c55923c..47b463347b 100644
--- a/epan/dissectors/packet-fcp.c
+++ b/epan/dissectors/packet-fcp.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/conversation.h>
diff --git a/epan/dissectors/packet-fcsb3.c b/epan/dissectors/packet-fcsb3.c
index 2c538a64a7..d3850119d5 100644
--- a/epan/dissectors/packet-fcsb3.c
+++ b/epan/dissectors/packet-fcsb3.c
@@ -48,10 +48,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/conversation.h>
diff --git a/epan/dissectors/packet-fcsp.c b/epan/dissectors/packet-fcsp.c
index 374d3c7d15..954e2518ff 100644
--- a/epan/dissectors/packet-fcsp.c
+++ b/epan/dissectors/packet-fcsp.c
@@ -48,10 +48,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/conversation.h>
diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c
index 85dacacad5..046a01f1d1 100644
--- a/epan/dissectors/packet-fcswils.c
+++ b/epan/dissectors/packet-fcswils.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-g723.c b/epan/dissectors/packet-g723.c
index 673417ac99..d5598324c6 100644
--- a/epan/dissectors/packet-g723.c
+++ b/epan/dissectors/packet-g723.c
@@ -35,10 +35,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "rtp_pt.h"
diff --git a/epan/dissectors/packet-gprs-llc.c b/epan/dissectors/packet-gprs-llc.c
index ed21f1a0cf..a8330a2d52 100644
--- a/epan/dissectors/packet-gprs-llc.c
+++ b/epan/dissectors/packet-gprs-llc.c
@@ -33,10 +33,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
diff --git a/epan/dissectors/packet-hyperscsi.c b/epan/dissectors/packet-hyperscsi.c
index fb7856c984..23f057d894 100644
--- a/epan/dissectors/packet-hyperscsi.c
+++ b/epan/dissectors/packet-hyperscsi.c
@@ -31,10 +31,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
static int proto_hyperscsi;
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index da53e41d90..9dce2337cb 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -769,7 +769,7 @@ add_fixed_field (proto_tree * tree, tvbuff_t * tvb, int offset, int lfcode)
case FIELD_TIMESTAMP:
dataptr = tvb_get_ptr (tvb, offset, 8);
memset (out_buff, 0, SHORT_STR);
- snprintf (out_buff, SHORT_STR, "0x%02X%02X%02X%02X%02X%02X%02X%02X",
+ g_snprintf (out_buff, SHORT_STR, "0x%02X%02X%02X%02X%02X%02X%02X%02X",
dataptr[7],
dataptr[6],
dataptr[5],
diff --git a/epan/dissectors/packet-igmp.c b/epan/dissectors/packet-igmp.c
index 8613976b71..0a06e89a3f 100644
--- a/epan/dissectors/packet-igmp.c
+++ b/epan/dissectors/packet-igmp.c
@@ -103,10 +103,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/ipproto.h>
#include <epan/in_cksum.h>
@@ -663,7 +659,7 @@ dissect_igmp_mtrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int typ
*/
if (type == IGMP_TRACEROUTE_RESPONSE) {
int i = (tvb_reported_length_remaining(tvb, offset) - IGMP_TRACEROUTE_HDR_LEN) / IGMP_TRACEROUTE_RSP_LEN;
- snprintf(buf, sizeof buf, ", %d block%s", i, plurality(i, "", "s"));
+ g_snprintf(buf, sizeof buf, ", %d block%s", i, plurality(i, "", "s"));
typestr = "Traceroute Response";
blocks = buf;
} else if (tvb_reported_length_remaining(tvb, offset) == IGMP_TRACEROUTE_HDR_LEN)
diff --git a/epan/dissectors/packet-image-gif.c b/epan/dissectors/packet-image-gif.c
index 4eefe72635..16819c1202 100644
--- a/epan/dissectors/packet-image-gif.c
+++ b/epan/dissectors/packet-image-gif.c
@@ -45,10 +45,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* General-purpose debug logger.
diff --git a/epan/dissectors/packet-image-jfif.c b/epan/dissectors/packet-image-jfif.c
index a05e5de3d8..2040e79401 100644
--- a/epan/dissectors/packet-image-jfif.c
+++ b/epan/dissectors/packet-image-jfif.c
@@ -48,10 +48,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* General-purpose debug logger.
diff --git a/epan/dissectors/packet-ipdc.c b/epan/dissectors/packet-ipdc.c
index adaefbc041..36f0681c2c 100644
--- a/epan/dissectors/packet-ipdc.c
+++ b/epan/dissectors/packet-ipdc.c
@@ -37,10 +37,6 @@
#include <glib.h>
#include <math.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "packet-ipdc.h"
#include "packet-tcp.h"
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c
index 5e0a0135e6..5371b9e0c8 100644
--- a/epan/dissectors/packet-ipv6.c
+++ b/epan/dissectors/packet-ipv6.c
@@ -383,7 +383,7 @@ dissect_ipv6_options(tvbuff_t *tvb, int offset, guint length,
optp = NULL; /* indicate that we don't know this option */
len_type = VARIABLE_LENGTH;
optlen = 0;
- snprintf(name_str, sizeof name_str, "Unknown (0x%02x)", opt);
+ g_snprintf(name_str, sizeof name_str, "Unknown (0x%02x)", opt);
name = name_str;
dissect = NULL;
} else {
diff --git a/epan/dissectors/packet-ipvs-syncd.c b/epan/dissectors/packet-ipvs-syncd.c
index 3b974beb23..01ad34a81c 100644
--- a/epan/dissectors/packet-ipvs-syncd.c
+++ b/epan/dissectors/packet-ipvs-syncd.c
@@ -30,10 +30,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/ipproto.h>
#include <epan/in_cksum.h>
diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c
index 1076ce44f5..e5242ea794 100644
--- a/epan/dissectors/packet-ismp.c
+++ b/epan/dissectors/packet-ismp.c
@@ -34,10 +34,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/strutil.h>
#include "etypes.h"
diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c
index f68da333b9..163426b7a1 100644
--- a/epan/dissectors/packet-isns.c
+++ b/epan/dissectors/packet-isns.c
@@ -47,10 +47,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "packet-tcp.h"
diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c
index e618be2552..a83f58b88b 100644
--- a/epan/dissectors/packet-isup.c
+++ b/epan/dissectors/packet-isup.c
@@ -5656,8 +5656,8 @@ static int msg_stats_tree_packet(stats_tree *st , packet_info *pinfo, epan_diss
int msg_node;
int dir_node;
- address_to_str_buf(&(pinfo->net_src), src);
- address_to_str_buf(&(pinfo->net_dst), dst);
+ address_to_str_buf(&(pinfo->net_src), src, sizeof src);
+ address_to_str_buf(&(pinfo->net_dst), dst, sizeof dst);
g_snprintf(dir,sizeof(dir),"%s->%s",src,dst);
msg_node = tick_stat_node(st, msg, st_node_msg, TRUE);
diff --git a/epan/dissectors/packet-isup_thin.c b/epan/dissectors/packet-isup_thin.c
index a60fa59811..192615ca5c 100644
--- a/epan/dissectors/packet-isup_thin.c
+++ b/epan/dissectors/packet-isup_thin.c
@@ -35,10 +35,6 @@
#include <glib.h>
#include <epan/conversation.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index e4c2cf61cb..fcabe44d69 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -1056,8 +1056,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
gchar src_addr[256];
gchar dst_addr[256];
- address_to_str_buf( &pinfo->src, src_addr );
- address_to_str_buf( &pinfo->dst, dst_addr );
+ address_to_str_buf( &pinfo->src, src_addr, sizeof src_addr );
+ address_to_str_buf( &pinfo->dst, dst_addr, sizeof dst_addr );
if( PT_NONE != pinfo->ptype ) {
size_t len = strlen( src_addr );
@@ -1088,8 +1088,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
gchar dst_addr[256];
proto_item * tree_item;
- address_to_str_buf( &pinfo->src, src_addr );
- address_to_str_buf( &pinfo->dst, dst_addr );
+ address_to_str_buf( &pinfo->src, src_addr, sizeof src_addr );
+ address_to_str_buf( &pinfo->dst, dst_addr, sizeof dst_addr );
if( PT_NONE != pinfo->ptype ) {
size_t len = strlen( src_addr );
diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c
index 53a9293a3d..740b2bd35b 100644
--- a/epan/dissectors/packet-kerberos.c
+++ b/epan/dissectors/packet-kerberos.c
@@ -1629,7 +1629,7 @@ static int dissect_krb5_address(packet_info *pinfo, proto_tree *tree, tvbuff_t *
int netbios_name_type;
netbios_name_type = process_netbios_name(tvb_get_ptr(tvb, offset, 16), netbios_name);
- snprintf(address_str, 255, "%s<%02x>", netbios_name, netbios_name_type);
+ g_snprintf(address_str, 255, "%s<%02x>", netbios_name, netbios_name_type);
it=proto_tree_add_string_format(tree, hf_krb_address_netbios, tvb, offset, 16, netbios_name, "NetBIOS Name: %s (%s)", address_str, netbios_name_type_descr(netbios_name_type));
}
break;
diff --git a/epan/dissectors/packet-laplink.c b/epan/dissectors/packet-laplink.c
index 2f737ba28d..9f02295074 100644
--- a/epan/dissectors/packet-laplink.c
+++ b/epan/dissectors/packet-laplink.c
@@ -33,10 +33,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/conversation.h>
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 1800225700..b54550225d 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -73,10 +73,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/asn1.h>
@@ -1808,7 +1804,7 @@ static void dissect_ldap_request_compare(ASN1_SCK *a, proto_tree *tree)
s2 = (string2 == NULL) ? "(null)" : string2;
length = 2 + strlen(s1) + strlen(s2);
compare = g_malloc0(length);
- snprintf(compare, length, "%s=%s", s1, s2);
+ g_snprintf(compare, length, "%s=%s", s1, s2);
proto_tree_add_string(tree, hf_ldap_message_compare, a->tvb, start,
a->offset-start, compare);
diff --git a/epan/dissectors/packet-lwapp.c b/epan/dissectors/packet-lwapp.c
index 8d5e55ed40..b0eb8360c8 100644
--- a/epan/dissectors/packet-lwapp.c
+++ b/epan/dissectors/packet-lwapp.c
@@ -43,10 +43,6 @@
#include <epan/prefs.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#define LWAPP_FLAGS_T 0x04
#define LWAPP_FLAGS_F 0x02
#define LWAPP_FLAGS_FT 0x01
diff --git a/epan/dissectors/packet-mdshdr.c b/epan/dissectors/packet-mdshdr.c
index 794ee6f372..e12de8e205 100644
--- a/epan/dissectors/packet-mdshdr.c
+++ b/epan/dissectors/packet-mdshdr.c
@@ -47,10 +47,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/value_string.h>
#include <etypes.h>
#include <epan/packet.h>
diff --git a/epan/dissectors/packet-msrp.c b/epan/dissectors/packet-msrp.c
index 31b26fcae2..b9ba83fa0d 100644
--- a/epan/dissectors/packet-msrp.c
+++ b/epan/dissectors/packet-msrp.c
@@ -38,10 +38,6 @@
#include <glib.h>
#include <epan/conversation.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
diff --git a/epan/dissectors/packet-mtp3.c b/epan/dissectors/packet-mtp3.c
index 7c196c3a92..6a5d55f26d 100644
--- a/epan/dissectors/packet-mtp3.c
+++ b/epan/dissectors/packet-mtp3.c
@@ -39,10 +39,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/tap.h>
#include <epan/prefs.h>
diff --git a/epan/dissectors/packet-mtp3mg.c b/epan/dissectors/packet-mtp3mg.c
index 5eab60dd42..692ac73182 100644
--- a/epan/dissectors/packet-mtp3mg.c
+++ b/epan/dissectors/packet-mtp3mg.c
@@ -39,10 +39,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
@@ -506,7 +502,7 @@ dissect_mtp3mg_3byte_pc(tvbuff_t *tvb, proto_tree *tree, gint *ett_pc,
apc = tvb_get_ntoh24(tvb, 0);
- snprintf(pc, sizeof(pc), "%d-%d-%d",
+ g_snprintf(pc, sizeof(pc), "%d-%d-%d",
(apc & ANSI_NETWORK_MASK),
((apc & ANSI_CLUSTER_MASK) >> 8),
((apc & ANSI_MEMBER_MASK) >> 16));
diff --git a/epan/dissectors/packet-multipart.c b/epan/dissectors/packet-multipart.c
index f7f113411c..5fda13e7ec 100644
--- a/epan/dissectors/packet-multipart.c
+++ b/epan/dissectors/packet-multipart.c
@@ -67,10 +67,6 @@
#include <glib.h>
#include <ctype.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* Dissector table for media requiring special attention in multipart
diff --git a/epan/dissectors/packet-ntp.c b/epan/dissectors/packet-ntp.c
index 3629f1adcd..aa13cfc9de 100644
--- a/epan/dissectors/packet-ntp.c
+++ b/epan/dissectors/packet-ntp.c
@@ -36,10 +36,6 @@
#include <math.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include "packet-ntp.h"
@@ -392,7 +388,7 @@ ntp_fmt_ts(const guint8 *reftime, char* buff)
bd = gmtime(&temptime);
if (bd != NULL) {
fractime = bd->tm_sec + tempfrac / 4294967296.0;
- snprintf(buff, NTP_TS_SIZE,
+ g_snprintf(buff, NTP_TS_SIZE,
"%s %2d, %d %02d:%02d:%07.4f UTC",
mon_names[bd->tm_mon],
bd->tm_mday,
@@ -550,7 +546,7 @@ dissect_ntp_std(tvbuff_t *tvb, proto_tree *ntp_tree, guint8 flags)
*/
refid = tvb_get_ptr(tvb, 12, 4);
if (stratum <= 1) {
- snprintf (buff, sizeof buff,
+ g_snprintf (buff, sizeof buff,
"Unindentified reference source '%.4s'",
refid);
for (i = 0; primary_sources[i].id; i++) {
diff --git a/epan/dissectors/packet-pflog.c b/epan/dissectors/packet-pflog.c
index 2412068a8d..197b166a6c 100644
--- a/epan/dissectors/packet-pflog.c
+++ b/epan/dissectors/packet-pflog.c
@@ -180,10 +180,10 @@ dissect_pflog(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
hdrlen = BPF_WORDALIGN(pflogh.length);
if (pflogh.subrulenr == (guint32) -1)
- snprintf(rulestr, sizeof(rulestr), "%u",
+ g_snprintf(rulestr, sizeof(rulestr), "%u",
pflogh.rulenr);
else
- snprintf(rulestr, sizeof(rulestr), "%u.%s.%u",
+ g_snprintf(rulestr, sizeof(rulestr), "%u.%s.%u",
pflogh.rulenr, pflogh.ruleset, pflogh.subrulenr);
if (hdrlen < MIN_PFLOG_HDRLEN) {
diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c
index ac0408c16e..768c37d51d 100644
--- a/epan/dissectors/packet-pim.c
+++ b/epan/dissectors/packet-pim.c
@@ -74,14 +74,14 @@ dissect_pimv1_addr(tvbuff_t *tvb, int offset) {
flags_masklen = tvb_get_ntohs(tvb, offset);
if (flags_masklen & 0x0180) {
- (void)snprintf(buf, sizeof(buf),
+ g_snprintf(buf, sizeof(buf),
"(%s%s%s) ",
flags_masklen & 0x0100 ? "S" : "",
flags_masklen & 0x0080 ? "W" : "",
flags_masklen & 0x0040 ? "R" : "");
} else
buf[0] = '\0';
- (void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s/%u",
+ g_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s/%u",
ip_to_str(tvb_get_ptr(tvb, offset + 2, 4)), flags_masklen & 0x3f);
return buf;
@@ -520,13 +520,13 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at,
switch (af) {
case AFNUM_INET:
len = 4;
- (void)snprintf(buf, sizeof(buf), "%s",
+ g_snprintf(buf, sizeof(buf), "%s",
ip_to_str(tvb_get_ptr(tvb, offset + 2, len)));
break;
case AFNUM_INET6:
len = 16;
- (void)snprintf(buf, sizeof(buf), "%s",
+ g_snprintf(buf, sizeof(buf), "%s",
ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 2, len)));
break;
}
@@ -539,13 +539,13 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at,
switch (af) {
case AFNUM_INET:
len = 4;
- (void)snprintf(buf, sizeof(buf), "%s/%u",
+ g_snprintf(buf, sizeof(buf), "%s/%u",
ip_to_str(tvb_get_ptr(tvb, offset + 4, len)), mask_len);
break;
case AFNUM_INET6:
len = 16;
- (void)snprintf(buf, sizeof(buf), "%s/%u",
+ g_snprintf(buf, sizeof(buf), "%s/%u",
ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len);
break;
}
@@ -559,18 +559,18 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at,
switch (af) {
case AFNUM_INET:
len = 4;
- (void)snprintf(buf, sizeof(buf), "%s/%u",
+ g_snprintf(buf, sizeof(buf), "%s/%u",
ip_to_str(tvb_get_ptr(tvb, offset + 4, len)), mask_len);
break;
case AFNUM_INET6:
len = 16;
- (void)snprintf(buf, sizeof(buf), "%s/%u",
+ g_snprintf(buf, sizeof(buf), "%s/%u",
ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len);
break;
}
if (flags) {
- (void)snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
+ g_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
" (%s%s%s)",
flags & 0x04 ? "S" : "",
flags & 0x02 ? "W" : "",
diff --git a/epan/dissectors/packet-pn-rt.c b/epan/dissectors/packet-pn-rt.c
index 0832e88a82..646d785428 100644
--- a/epan/dissectors/packet-pn-rt.c
+++ b/epan/dissectors/packet-pn-rt.c
@@ -261,7 +261,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
u8DataStatus = tvb_get_guint8(tvb, tvb_len - 2);
u8TransferStatus = tvb_get_guint8(tvb, tvb_len - 1);
- snprintf (szFieldSummary, sizeof(szFieldSummary),
+ g_snprintf (szFieldSummary, sizeof(szFieldSummary),
"%sFrameID: 0x%04x, DataLen: %4u, Cycle: %5u (%s,%s,%s,%s)",
pszProtAddInfo, u16FrameID, tvb_len - 2 - 4, u16CycleCounter,
(u8DataStatus & 0x04) ? "Valid" : "Invalid",
@@ -278,7 +278,7 @@ dissect_pn_rt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
u8TransferStatus = 0;
/* acyclic transfer has no fields at the end */
- snprintf (szFieldSummary, sizeof(szFieldSummary),
+ g_snprintf (szFieldSummary, sizeof(szFieldSummary),
"%sFrameID: 0x%04x, DataLen: %4u",
pszProtAddInfo, u16FrameID, tvb_len - 2);
diff --git a/epan/dissectors/packet-ptp.c b/epan/dissectors/packet-ptp.c
index 89763b1496..da37752cd5 100644
--- a/epan/dissectors/packet-ptp.c
+++ b/epan/dissectors/packet-ptp.c
@@ -37,10 +37,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c
index 6811a5aa54..0341871ae6 100644
--- a/epan/dissectors/packet-rsvp.c
+++ b/epan/dissectors/packet-rsvp.c
@@ -70,10 +70,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/tvbuff.h>
#include <epan/packet.h>
#include <prefs.h>
@@ -1257,31 +1253,31 @@ static char *summary_session (tvbuff_t *tvb, int offset)
switch(tvb_get_guint8(tvb, offset+3)) {
case RSVP_SESSION_TYPE_IPV4:
- snprintf(buf, 100, "SESSION: IPv4, Destination %s, Protocol %d, Port %d. ",
+ g_snprintf(buf, 100, "SESSION: IPv4, Destination %s, Protocol %d, Port %d. ",
ip_to_str(tvb_get_ptr(tvb, offset+4, 4)),
tvb_get_guint8(tvb, offset+8),
tvb_get_ntohs(tvb, offset+10));
break;
case RSVP_SESSION_TYPE_IPV4_LSP:
- snprintf(buf, 100, "SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ",
+ g_snprintf(buf, 100, "SESSION: IPv4-LSP, Destination %s, Tunnel ID %d, Ext ID %0x. ",
ip_to_str(tvb_get_ptr(tvb, offset+4, 4)),
tvb_get_ntohs(tvb, offset+10),
tvb_get_ntohl(tvb, offset+12));
break;
case RSVP_SESSION_TYPE_IPV4_UNI:
- snprintf(buf, 100, "SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ",
+ g_snprintf(buf, 100, "SESSION: IPv4-UNI, Destination %s, Tunnel ID %d, Ext Address %s. ",
ip_to_str(tvb_get_ptr(tvb, offset+4, 4)),
tvb_get_ntohs(tvb, offset+10),
ip_to_str(tvb_get_ptr(tvb, offset+12, 4)));
break;
case RSVP_SESSION_TYPE_IPV4_E_NNI:
- snprintf(buf, 100, "SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ",
+ g_snprintf(buf, 100, "SESSION: IPv4-E-NNI, Destination %s, Tunnel ID %d, Ext Address %s. ",
ip_to_str(tvb_get_ptr(tvb, offset+4, 4)),
tvb_get_ntohs(tvb, offset+10),
ip_to_str(tvb_get_ptr(tvb, offset+12, 4)));
break;
default:
- snprintf(buf, 100, "SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3));
+ g_snprintf(buf, 100, "SESSION: Type %d. ", tvb_get_guint8(tvb, offset+3));
}
return buf;
@@ -1299,17 +1295,17 @@ static char *summary_template (tvbuff_t *tvb, int offset)
switch(tvb_get_guint8(tvb, offset+3)) {
case 1:
- snprintf(buf, 80, "%s: IPv4, Sender %s, Port %d. ", objtype,
+ g_snprintf(buf, 80, "%s: IPv4, Sender %s, Port %d. ", objtype,
ip_to_str(tvb_get_ptr(tvb, offset+4, 4)),
tvb_get_ntohs(tvb, offset+10));
break;
case 7:
- snprintf(buf, 80, "%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype,
+ g_snprintf(buf, 80, "%s: IPv4-LSP, Tunnel Source: %s, LSP ID: %d. ", objtype,
ip_to_str(tvb_get_ptr(tvb, offset+4, 4)),
tvb_get_ntohs(tvb, offset+10));
break;
default:
- snprintf(buf, 80, "%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3));
+ g_snprintf(buf, 80, "%s: Type %d. ", objtype, tvb_get_guint8(tvb, offset+3));
}
return buf;
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index ac56796c1f..538e930a7c 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -40,10 +40,6 @@
# include "config.h"
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/epan/dissectors/packet-sccp.c b/epan/dissectors/packet-sccp.c
index aae0dbb116..9a3a06efca 100644
--- a/epan/dissectors/packet-sccp.c
+++ b/epan/dissectors/packet-sccp.c
@@ -41,10 +41,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "packet-mtp3.h"
#include <epan/prefs.h>
@@ -863,7 +859,7 @@ dissect_sccp_3byte_pc(tvbuff_t *tvb, proto_tree *call_tree, guint offset,
/* create the DPC tree; modified from that in packet-mtp3.c */
dpc = tvb_get_ntoh24(tvb, offset);
- snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK),
+ g_snprintf(pc, sizeof(pc), "%d-%d-%d", (dpc & ANSI_NETWORK_MASK),
((dpc & ANSI_CLUSTER_MASK) >> 8),
((dpc & ANSI_MEMBER_MASK) >> 16));
diff --git a/epan/dissectors/packet-sccpmg.c b/epan/dissectors/packet-sccpmg.c
index a0f90fcdba..26d836e212 100644
--- a/epan/dissectors/packet-sccpmg.c
+++ b/epan/dissectors/packet-sccpmg.c
@@ -39,10 +39,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "packet-mtp3.h"
@@ -170,7 +166,7 @@ dissect_sccpmg_affected_pc(tvbuff_t *tvb, proto_tree *sccpmg_tree)
/* create the DPC tree; modified from that in packet-sccp.c */
dpc = tvb_get_ntoh24(tvb, offset);
- snprintf(pc, sizeof(pc), "%d-%d-%d",
+ g_snprintf(pc, sizeof(pc), "%d-%d-%d",
(dpc & ANSI_NETWORK_MASK),
((dpc & ANSI_CLUSTER_MASK) >> 8),
((dpc & ANSI_MEMBER_MASK) >> 16));
diff --git a/epan/dissectors/packet-sebek.c b/epan/dissectors/packet-sebek.c
index 959e03c7fd..5646847d8c 100644
--- a/epan/dissectors/packet-sebek.c
+++ b/epan/dissectors/packet-sebek.c
@@ -36,10 +36,6 @@
#include <math.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/addr_resolv.h>
diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c
index aedb28796c..57ffcd8d4a 100644
--- a/epan/dissectors/packet-sflow.c
+++ b/epan/dissectors/packet-sflow.c
@@ -54,10 +54,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/*#include "packet-sflow.h"*/
diff --git a/epan/dissectors/packet-sigcomp.c b/epan/dissectors/packet-sigcomp.c
index b4055fbb14..69eb33be6c 100644
--- a/epan/dissectors/packet-sigcomp.c
+++ b/epan/dissectors/packet-sigcomp.c
@@ -39,10 +39,6 @@
#include <math.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
#include "strutil.h"
diff --git a/epan/dissectors/packet-sndcp.c b/epan/dissectors/packet-sndcp.c
index 91ae6cc2ca..9736d35a61 100644
--- a/epan/dissectors/packet-sndcp.c
+++ b/epan/dissectors/packet-sndcp.c
@@ -33,10 +33,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/reassemble.h>
diff --git a/epan/dissectors/packet-stun.c b/epan/dissectors/packet-stun.c
index 8b9f5317d5..5bdf225198 100644
--- a/epan/dissectors/packet-stun.c
+++ b/epan/dissectors/packet-stun.c
@@ -35,10 +35,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* Initialize the protocol and registered fields */
diff --git a/epan/dissectors/packet-uma.c b/epan/dissectors/packet-uma.c
index 12a4bbb888..b4a3f5aebf 100644
--- a/epan/dissectors/packet-uma.c
+++ b/epan/dissectors/packet-uma.c
@@ -62,10 +62,6 @@
#include <glib.h>
#include <epan/conversation.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
#include "packet-bssap.h"
diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c
index ef5d89fb62..bcd8d6a79f 100644
--- a/epan/dissectors/packet-wccp.c
+++ b/epan/dissectors/packet-wccp.c
@@ -33,10 +33,6 @@
#include <epan/strutil.h>
#include "packet-wccp.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
static int proto_wccp = -1;
static int hf_wccp_message_type = -1; /* the message type */
static int hf_wccp_version = -1; /* protocol version */
@@ -1228,10 +1224,10 @@ dissect_32_bit_capability_flags(tvbuff_t *tvb, int curr_offset,
for (i = 0; flags[i].short_name != NULL; i++) {
if (capability_val & flags[i].value) {
if (p != &flags_string[0]) {
- snprintf(p, space_left, ",");
+ g_snprintf(p, space_left, ",");
p = &flags_string[strlen(flags_string)];
}
- snprintf(p, space_left, "%s", flags[i].short_name);
+ g_snprintf(p, space_left, "%s", flags[i].short_name);
p = &flags_string[strlen(flags_string)];
}
}
diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c
index b146439b11..cdb518647d 100644
--- a/epan/dissectors/packet-wsp.c
+++ b/epan/dissectors/packet-wsp.c
@@ -51,10 +51,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
diff --git a/epan/dissectors/packet-wtls.c b/epan/dissectors/packet-wtls.c
index 8ce0374af6..9995cb6aa6 100644
--- a/epan/dissectors/packet-wtls.c
+++ b/epan/dissectors/packet-wtls.c
@@ -34,10 +34,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
@@ -804,22 +800,22 @@ dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint coun
{
if (valMac != NULL)
{
- snprintf(valStr,1024,"%s, %s",valBulk,valMac);
+ g_snprintf(valStr,1024,"%s, %s",valBulk,valMac);
}
else
{
- snprintf(valStr,1024,"%s, Unknown MAC (0x%02x)",valBulk,tvb_get_guint8 (tvb, offset));
+ g_snprintf(valStr,1024,"%s, Unknown MAC (0x%02x)",valBulk,tvb_get_guint8 (tvb, offset));
}
}
else
{
if (valMac != NULL)
{
- snprintf(valStr,1024,"Unknown Bulk (0x%02x), %s",value,valMac);
+ g_snprintf(valStr,1024,"Unknown Bulk (0x%02x), %s",value,valMac);
}
else
{
- snprintf(valStr,1024,"Unknown Bulk (0x%02x), Unknown MAC (0x%02x)",value,
+ g_snprintf(valStr,1024,"Unknown Bulk (0x%02x), Unknown MAC (0x%02x)",value,
tvb_get_guint8 (tvb, offset));
}
}
diff --git a/epan/dissectors/packet-wtp.c b/epan/dissectors/packet-wtp.c
index 36649ead4c..1a71192465 100644
--- a/epan/dissectors/packet-wtp.c
+++ b/epan/dissectors/packet-wtp.c
@@ -34,10 +34,6 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
diff --git a/epan/filesystem.c b/epan/filesystem.c
index f87644969d..d042e426c6 100644
--- a/epan/filesystem.c
+++ b/epan/filesystem.c
@@ -374,9 +374,8 @@ get_persconffile_dir(void)
/*
* Concatenate %APPDATA% with "\Ethereal".
*/
- pf_dir = g_malloc(strlen(appdatadir) + strlen(PF_DIR) + 2);
- sprintf(pf_dir, "%s" G_DIR_SEPARATOR_S "%s", appdatadir,
- PF_DIR);
+ pf_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s",
+ appdatadir, PF_DIR);
} else {
/*
* OK, %APPDATA% wasn't set, so use
@@ -384,17 +383,14 @@ get_persconffile_dir(void)
*/
userprofiledir = getenv("USERPROFILE");
if (userprofiledir != NULL) {
- pf_dir = g_malloc(strlen(userprofiledir) +
- strlen("Application Data") + strlen(PF_DIR) + 3);
- sprintf(pf_dir,
+ pf_dir = g_strdup_printf(
"%s" G_DIR_SEPARATOR_S "Application Data" G_DIR_SEPARATOR_S "%s",
userprofiledir, PF_DIR);
} else {
/*
* Give up and use "C:".
*/
- pf_dir = g_malloc(strlen("C:") + strlen(PF_DIR) + 2);
- sprintf(pf_dir, "C:" G_DIR_SEPARATOR_S "%s", PF_DIR);
+ pf_dir = g_strdup_printf("C:" G_DIR_SEPARATOR_S "%s", PF_DIR);
}
}
#else
@@ -418,8 +414,7 @@ get_persconffile_dir(void)
} else
homedir = "/tmp";
}
- pf_dir = g_malloc(strlen(homedir) + strlen(PF_DIR) + 2);
- sprintf(pf_dir, "%s" G_DIR_SEPARATOR_S "%s", homedir, PF_DIR);
+ pf_dir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", homedir, PF_DIR);
#endif
return pf_dir;
@@ -573,9 +568,7 @@ get_persconffile_path(const char *filename, gboolean for_writing
char *old_path;
#endif
- path = (gchar *) g_malloc(strlen(get_persconffile_dir()) +
- strlen(filename) + 2);
- sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(),
+ path = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(),
filename);
#ifdef _WIN32
if (!for_writing) {
@@ -585,9 +578,7 @@ get_persconffile_path(const char *filename, gboolean for_writing
* directory; is it in the ".ethereal" subdirectory
* of their home directory?
*/
- old_path = (gchar *) g_malloc(strlen(get_home_dir()) +
- strlen(".ethereal") + strlen(filename) + 3);
- sprintf(old_path,
+ old_path = g_strdup_printf(
"%s" G_DIR_SEPARATOR_S ".ethereal" G_DIR_SEPARATOR_S "%s",
get_home_dir(), filename);
if (stat(old_path, &s_buf) == 0) {
@@ -611,14 +602,9 @@ get_persconffile_path(const char *filename, gboolean for_writing
char *
get_datafile_path(const char *filename)
{
- char *path;
- path = (gchar *) g_malloc(strlen(get_datafile_dir()) +
- strlen(filename) + 2);
- sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", get_datafile_dir(),
+ return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", get_datafile_dir(),
filename);
-
- return path;
}
/* Delete a file */
@@ -634,13 +620,8 @@ deletefile(const char *path)
*/
char *get_tempfile_path(const char *filename)
{
- char *path;
-
- path = (gchar *) g_malloc(strlen(g_get_tmp_dir()) +
- strlen(filename) + 2);
- sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename);
- return path;
+ return g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", g_get_tmp_dir(), filename);
}
/*
@@ -684,7 +665,7 @@ file_open_error_message(int err, gboolean for_writing)
#endif
default:
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" could not be %s: %s.",
for_writing ? "created" : "opened",
strerror(err));
@@ -717,7 +698,7 @@ file_write_error_message(int err)
#endif
default:
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"An error occurred while writing to the file \"%%s\": %s.",
strerror(err));
errmsg = errmsg_errno;
diff --git a/epan/follow.c b/epan/follow.c
index 429e077338..f1dc7ccbad 100644
--- a/epan/follow.c
+++ b/epan/follow.c
@@ -80,12 +80,12 @@ follow_tcp_stats(follow_tcp_stats_t* stats)
very good one */
char*
build_follow_filter( packet_info *pi ) {
- char* buf = g_malloc(1024);
+ char* buf;
int len;
if( pi->net_src.type == AT_IPv4 && pi->net_dst.type == AT_IPv4
&& pi->ipproto == 6 ) {
/* TCP over IPv4 */
- sprintf( buf,
+ buf = g_strdup_printf(
"(ip.addr eq %s and ip.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
ip_to_str( pi->net_src.data),
ip_to_str( pi->net_dst.data),
@@ -96,7 +96,7 @@ build_follow_filter( packet_info *pi ) {
else if( pi->net_src.type == AT_IPv6 && pi->net_dst.type == AT_IPv6
&& pi->ipproto == 6 ) {
/* TCP over IPv6 */
- sprintf( buf,
+ buf = g_strdup_printf(
"(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)",
ip6_to_str((const struct e_in6_addr *)pi->net_src.data),
ip6_to_str((const struct e_in6_addr *)pi->net_dst.data),
@@ -105,7 +105,6 @@ build_follow_filter( packet_info *pi ) {
is_ipv6 = TRUE;
}
else {
- g_free( buf );
return NULL;
}
memcpy(ip_address[0], pi->net_src.data, len);
diff --git a/epan/inet_ntop.c b/epan/inet_ntop.c
index 65b4db3a44..1d32204ccc 100644
--- a/epan/inet_ntop.c
+++ b/epan/inet_ntop.c
@@ -56,12 +56,10 @@ static char rcsid[] = "$Id$";
#include <stdio.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "inet_v6defs.h"
+#include <glib.h>
+
#ifndef NS_INADDRSZ
#define NS_INADDRSZ 4
#endif
@@ -128,9 +126,9 @@ inet_ntop4(src, dst, size)
char tmp[sizeof "255.255.255.255"];
int nprinted;
- nprinted = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
+ nprinted = g_snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
if (nprinted < 0)
- return (NULL); /* we assume "errno" was set by "snprintf()" */
+ return (NULL); /* we assume "errno" was set by "g_snprintf()" */
if ((size_t)nprinted > size) {
errno = ENOSPC;
return (NULL);
diff --git a/epan/ipproto.c b/epan/ipproto.c
index 77d9bb4702..69f317d86f 100644
--- a/epan/ipproto.c
+++ b/epan/ipproto.c
@@ -37,10 +37,6 @@
#include <epan/addr_resolv.h>
#include <epan/dissectors/packet-ip.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
static const value_string ipproto_val[] = {
#if 0
{ IP_PROTO_IP, "IPv4" },
@@ -210,6 +206,6 @@ const char *ipprotostr(int proto) {
s = "Unknown";
ok:
- snprintf(buf, sizeof(buf), "%s", s);
+ g_snprintf(buf, sizeof(buf), "%s", s);
return buf;
}
diff --git a/epan/plugins.c b/epan/plugins.c
index f9b3e201c0..b4f665b369 100644
--- a/epan/plugins.c
+++ b/epan/plugins.c
@@ -26,10 +26,6 @@
# include "config.h"
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "plugins.h"
#ifdef HAVE_PLUGINS
@@ -187,7 +183,7 @@ plugins_scan_dir(const char *dirname)
dot = strrchr(file->d_name, '.');
if (dot == NULL || strcmp(dot, lt_lib_ext) != 0) continue;
- snprintf(filename, FILENAME_LEN, "%s" G_DIR_SEPARATOR_S "%s",
+ g_snprintf(filename, FILENAME_LEN, "%s" G_DIR_SEPARATOR_S "%s",
dirname, file->d_name);
name = (gchar *)file->d_name;
#else /* GLIB 2 */
@@ -205,7 +201,7 @@ plugins_scan_dir(const char *dirname)
dot = strrchr(name, '.');
if (dot == NULL || strcmp(dot+1, G_MODULE_SUFFIX) != 0) continue;
- snprintf(filename, FILENAME_LEN, "%s" G_DIR_SEPARATOR_S "%s",
+ g_snprintf(filename, FILENAME_LEN, "%s" G_DIR_SEPARATOR_S "%s",
dirname, name);
#endif
if ((handle = g_module_open(filename, 0)) == NULL)
diff --git a/epan/proto.c b/epan/proto.c
index 803fe2feef..caeebfe5f1 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -1575,8 +1575,7 @@ proto_item_append_string(proto_item *pi, const char *str)
hfinfo = fi->hfinfo;
DISSECTOR_ASSERT(hfinfo->type == FT_STRING || hfinfo->type == FT_STRINGZ);
old_str = fvalue_get(&fi->value);
- new_str = g_malloc(strlen(old_str) + strlen(str) + 1);
- sprintf(new_str, "%s%s", old_str, str);
+ new_str = g_strdup_printf("%s%s", old_str, str);
fvalue_set(&fi->value, new_str, TRUE);
}
diff --git a/epan/sigcomp-udvm.c b/epan/sigcomp-udvm.c
index 57b1234cac..fa904c458f 100644
--- a/epan/sigcomp-udvm.c
+++ b/epan/sigcomp-udvm.c
@@ -39,10 +39,6 @@
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "packet.h"
#include "strutil.h"
#include "sigcomp-udvm.h"
diff --git a/epan/sigcomp_state_hdlr.c b/epan/sigcomp_state_hdlr.c
index 2909a58bbf..ef1d8c0e68 100644
--- a/epan/sigcomp_state_hdlr.c
+++ b/epan/sigcomp_state_hdlr.c
@@ -45,10 +45,6 @@
#include <glib.h>
#include "strutil.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "packet.h"
#include "sigcomp_state_hdlr.h"
/*
diff --git a/epan/to_str.c b/epan/to_str.c
index 6ccdd4bcbc..e678246b01 100644
--- a/epan/to_str.c
+++ b/epan/to_str.c
@@ -33,10 +33,6 @@
# include <sys/types.h> /* needed for <netinet/in.h> */
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* needed for <arpa/inet.h> on some platforms */
#endif
@@ -512,15 +508,15 @@ display_signed_time(gchar *buf, int buflen, gint32 sec, gint32 frac,
switch (units) {
case MSECS:
- snprintf(buf, buflen, "%s%d.%03d", sign, sec, frac);
+ g_snprintf(buf, buflen, "%s%d.%03d", sign, sec, frac);
break;
case USECS:
- snprintf(buf, buflen, "%s%d.%06d", sign, sec, frac);
+ g_snprintf(buf, buflen, "%s%d.%06d", sign, sec, frac);
break;
case NSECS:
- snprintf(buf, buflen, "%s%d.%09d", sign, sec, frac);
+ g_snprintf(buf, buflen, "%s%d.%09d", sign, sec, frac);
break;
}
}
@@ -624,7 +620,7 @@ fcwwn_to_str (const guint8 *ad)
case FC_NH_NAA_IEEE:
case FC_NH_NAA_IEEE_E:
memcpy (oui, &ad[2], 6);
- sprintf (ethstr, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)", ad[0],
+ g_snprintf (ethstr, 512, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)", ad[0],
ad[1], ad[2], ad[3], ad[4], ad[5], ad[6], ad[7],
get_manuf_name (oui));
break;
@@ -637,13 +633,13 @@ fcwwn_to_str (const guint8 *ad)
oui[4] = ((ad[4] & 0x0F) << 4) | ((ad[5] & 0xF0) >> 4);
oui[5] = ((ad[5] & 0x0F) << 4) | ((ad[6] & 0xF0) >> 4);
- sprintf (ethstr, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)", ad[0],
+ g_snprintf (ethstr, 512, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x (%s)", ad[0],
ad[1], ad[2], ad[3], ad[4], ad[5], ad[6], ad[7],
get_manuf_name (oui));
break;
default:
- sprintf (ethstr, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", ad[0],
+ g_snprintf (ethstr, 512, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", ad[0],
ad[1], ad[2], ad[3], ad[4], ad[5], ad[6], ad[7]);
break;
}
@@ -753,18 +749,18 @@ address_to_str(const address *addr)
gchar *str;
str=ep_alloc(256);
- address_to_str_buf(addr, str);
+ address_to_str_buf(addr, str, 256);
return str;
}
void
-address_to_str_buf(const address *addr, gchar *buf)
+address_to_str_buf(const address *addr, gchar *buf, int buf_len)
{
struct atalk_ddp_addr ddp_addr;
switch(addr->type){
case AT_ETHER:
- sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x", addr->data[0], addr->data[1], addr->data[2], addr->data[3], addr->data[4], addr->data[5]);
+ g_snprintf(buf, buf_len, "%02x:%02x:%02x:%02x:%02x:%02x", addr->data[0], addr->data[1], addr->data[2], addr->data[3], addr->data[4], addr->data[5]);
break;
case AT_IPv4:
ip_to_str_buf(addr->data, buf);
@@ -773,14 +769,14 @@ address_to_str_buf(const address *addr, gchar *buf)
inet_ntop(AF_INET6, addr->data, buf, INET6_ADDRSTRLEN);
break;
case AT_IPX:
- sprintf(buf, "%02x%02x%02x%02x.%02x%02x%02x%02x%02x%02x", addr->data[0], addr->data[1], addr->data[2], addr->data[3], addr->data[4], addr->data[5], addr->data[6], addr->data[7], addr->data[8], addr->data[9]);
+ g_snprintf(buf, buf_len, "%02x%02x%02x%02x.%02x%02x%02x%02x%02x%02x", addr->data[0], addr->data[1], addr->data[2], addr->data[3], addr->data[4], addr->data[5], addr->data[6], addr->data[7], addr->data[8], addr->data[9]);
break;
case AT_SNA:
sna_fid_to_str_buf(addr, buf);
break;
case AT_ATALK:
memcpy(&ddp_addr, addr->data, sizeof ddp_addr);
- atalk_addr_to_str_buf(&ddp_addr, buf);
+ atalk_addr_to_str_buf(&ddp_addr, buf, buf_len);
break;
case AT_VINES:
vines_addr_to_str_buf(addr->data, buf);
@@ -789,10 +785,10 @@ address_to_str_buf(const address *addr, gchar *buf)
print_nsap_net_buf(addr->data, addr->len, buf);
break;
case AT_ARCNET:
- sprintf(buf, "0x%02X", addr->data[0]);
+ g_snprintf(buf, buf_len, "0x%02X", addr->data[0]);
break;
case AT_FC:
- sprintf(buf, "%02x.%02x.%02x", addr->data[0], addr->data[1], addr->data[2]);
+ g_snprintf(buf, buf_len, "%02x.%02x.%02x", addr->data[0], addr->data[1], addr->data[2]);
break;
case AT_SS7PC:
mtp3_addr_to_str_buf(addr->data, buf);
@@ -801,7 +797,7 @@ address_to_str_buf(const address *addr, gchar *buf)
strcpy(buf, addr->data);
break;
case AT_EUI64:
- sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
+ g_snprintf(buf, buf_len, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
addr->data[0], addr->data[1], addr->data[2], addr->data[3],
addr->data[4], addr->data[5], addr->data[6], addr->data[7]);
break;
diff --git a/epan/to_str.h b/epan/to_str.h
index 0035ac1b71..3f49ea6178 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -50,7 +50,7 @@ typedef enum {
struct e_in6_addr;
extern gchar* address_to_str(const address *);
-extern void address_to_str_buf(const address *, gchar *);
+extern void address_to_str_buf(const address *addr, gchar *buf, int buf_len);
extern gchar* ether_to_str(const guint8 *);
extern gchar* ip_to_str(const guint8 *);
extern void ip_to_str_buf(const guint8 *, gchar *);
diff --git a/epan/value_string.c b/epan/value_string.c
index d2874379de..45daa54184 100644
--- a/epan/value_string.c
+++ b/epan/value_string.c
@@ -28,9 +28,6 @@
#include <stdio.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
#include "to_str.h"
#include "value_string.h"
@@ -56,7 +53,7 @@ val_to_str(guint32 val, const value_string *vs, const char *fmt) {
} else {
cur = &str[0][0];
}
- snprintf(cur, 64, fmt, val);
+ g_snprintf(cur, 64, fmt, val);
return cur;
}
diff --git a/filters.c b/filters.c
index e8aa3cb33f..f24f1d30c8 100644
--- a/filters.c
+++ b/filters.c
@@ -458,8 +458,7 @@ save_filter_list(filter_list_type_t list, char **pref_path_return,
/* Write to "XXX.new", and rename if that succeeds.
That means we don't trash the file if we fail to write it out
completely. */
- ff_path_new = (gchar *) g_malloc(strlen(ff_path) + 5);
- sprintf(ff_path_new, "%s.new", ff_path);
+ ff_path_new = g_strdup_printf("%s.new", ff_path);
if ((ff = fopen(ff_path_new, "w")) == NULL) {
*pref_path_return = ff_path;
diff --git a/pcap-util-unix.c b/pcap-util-unix.c
index ae14754aba..9f4a6798d7 100644
--- a/pcap-util-unix.c
+++ b/pcap-util-unix.c
@@ -93,7 +93,7 @@ get_interface_list(int *err, char *err_str)
if (sock < 0) {
*err = CANT_GET_INTERFACE_LIST;
- sprintf(err_str, "Error opening socket: %s",
+ g_snprintf(err_str, PCAP_ERRBUF_SIZE, "Error opening socket: %s",
strerror(errno));
return NULL;
}
@@ -111,14 +111,14 @@ get_interface_list(int *err, char *err_str)
memset (buf, 0, len);
if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) {
if (errno != EINVAL || lastlen != 0) {
- sprintf(err_str,
+ g_snprintf(err_str, PCAP_ERRBUF_SIZE,
"SIOCGIFCONF ioctl error getting list of interfaces: %s",
strerror(errno));
goto fail;
}
} else {
if ((unsigned) ifc.ifc_len < sizeof(struct ifreq)) {
- sprintf(err_str,
+ g_snprintf(err_str, PCAP_ERRBUF_SIZE,
"SIOCGIFCONF ioctl gave too small return buffer");
goto fail;
}
@@ -165,7 +165,8 @@ get_interface_list(int *err, char *err_str)
if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
if (errno == ENXIO)
goto next;
- sprintf(err_str, "SIOCGIFFLAGS error getting flags for interface %s: %s",
+ g_snprintf(err_str, PCAP_ERRBUF_SIZE,
+ "SIOCGIFFLAGS error getting flags for interface %s: %s",
ifr->ifr_name, strerror(errno));
goto fail;
}
diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c
index 22b54558d0..1e965e00cb 100644
--- a/plugins/asn1/packet-asn1.c
+++ b/plugins/asn1/packet-asn1.c
@@ -624,7 +624,7 @@ checklength(int len, int def, int cls, int tag, char *lenstr, int strmax)
int newlen = len;
if ( ! def) {
- snprintf(lenstr, strmax, "indefinite");
+ g_snprintf(lenstr, strmax, "indefinite");
return len;
}
@@ -694,9 +694,9 @@ checklength(int len, int def, int cls, int tag, char *lenstr, int strmax)
if (newlen != len) {
/* a change was needed.... */
- snprintf(lenstr, strmax, "%d(changed from %d)", newlen, len);
+ g_snprintf(lenstr, strmax, "%d(changed from %d)", newlen, len);
} else {
- snprintf(lenstr, strmax, "%d", len);
+ g_snprintf(lenstr, strmax, "%d", len);
}
return newlen;
}
@@ -750,7 +750,7 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
offstr[0] = 0;
if ((first_pdu_offset > 0) && !reassembled) {
boffset = first_pdu_offset;
- snprintf(offstr, sizeof(offstr), " at %d", boffset);
+ g_snprintf(offstr, sizeof(offstr), " at %d", boffset);
}
/* open BER decoding */
@@ -769,9 +769,9 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (asn1_debug) {
- snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
+ g_snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
- snprintf(headstr, sizeof(headstr), "first%s: (%s)%s %d %s, %s, %s, len=%s, off=%d, size=%d ",
+ g_snprintf(headstr, sizeof(headstr), "first%s: (%s)%s %d %s, %s, %s, len=%s, off=%d, size=%d ",
offstr,
tname,
name,
@@ -785,10 +785,10 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
);
} else {
if (props.flags & OUT_FLAG_noname) {
- snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
+ g_snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
name = ((cls == ASN1_UNI) && (tag < 32)) ? asn1_tag[tag] : tagstr;
}
- snprintf(headstr, sizeof(headstr), "first pdu%s: (%s)%s ", offstr, tname, name );
+ g_snprintf(headstr, sizeof(headstr), "first pdu%s: (%s)%s ", offstr, tname, name );
}
/* Set the info column */
@@ -837,9 +837,9 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
if (asn1_debug) {
- snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
+ g_snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
- snprintf(headstr, sizeof(headstr), "%s, %s, %s, len=%s, off=%d, remaining=%d",
+ g_snprintf(headstr, sizeof(headstr), "%s, %s, %s, len=%s, off=%d, remaining=%d",
asn1_cls[cls],
asn1_con[con],
((cls == ASN1_UNI) && (tag < 32)) ? asn1_tag[tag] : tagstr,
@@ -865,7 +865,7 @@ dissect_asn1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
}
} else {
if (props.flags & OUT_FLAG_noname) {
- snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
+ g_snprintf(tagstr, sizeof(tagstr), "%ctag%d", tag_class[cls], tag);
name = ((cls == ASN1_UNI) && (tag < 32)) ? asn1_tag[tag] : tagstr;
}
if (props.value_id == -1)
@@ -985,14 +985,14 @@ decode_asn1_sequence(tvbuff_t *tvb, guint offset, guint tlen, proto_tree *pt, in
if ((cls == ASN1_UNI) && ( tag < 32 )) {
tagstr = asn1_tag[tag];
} else {
- snprintf(tagbuf, sizeof(tagbuf), "%ctag%d", tag_class[cls], tag);
+ g_snprintf(tagbuf, sizeof(tagbuf), "%ctag%d", tag_class[cls], tag);
tagstr = tagbuf;
}
len = checklength(len, def, cls, tag, lenbuf, sizeof(lenbuf));
if (def) {
- snprintf(nnbuf, sizeof(nnbuf), "NN%d", len);
+ g_snprintf(nnbuf, sizeof(nnbuf), "NN%d", len);
} else {
strncpy(nnbuf, "NN-", sizeof(nnbuf));
/* make sure we get an exception if we run off the end! */
@@ -1737,11 +1737,11 @@ parse_tt3(tvbuff_t *tvb, guint offset, guint size, guint level, GNode *ptr)
if ((cls == ASN1_UNI) && ( tag < 32 )) {
tagstr = asn1_tag[tag];
} else {
- snprintf(tagbuf, sizeof(tagbuf), "tag%d", tag);
+ g_snprintf(tagbuf, sizeof(tagbuf), "tag%d", tag);
tagstr = tagbuf;
}
if (def) {
- snprintf(lenbuf, sizeof(lenbuf), "%d", len);
+ g_snprintf(lenbuf, sizeof(lenbuf), "%d", len);
} else {
strncpy(lenbuf, "indefinite", sizeof(lenbuf));
len = tvb_length_remaining(tvb, offset);
@@ -1817,7 +1817,7 @@ parse_tt3(tvbuff_t *tvb, guint offset, guint size, guint level, GNode *ptr)
case ASN1_CTX: /* fprintf(stderr, "Context\n"); */
tagstr = tagbuf;
- snprintf(tagbuf, sizeof(tagbuf), "TAG%d", tag);
+ g_snprintf(tagbuf, sizeof(tagbuf), "TAG%d", tag);
if (def && !con) {
/* defined length, not constructed, must be a string.... */
asn1_string_value_decode(&asn1, len, &octets); /* read value */
@@ -1863,11 +1863,11 @@ myLeaf(GNode *node, gpointer data)
if ((cls == ASN1_UNI) && ( tag < 32 )) {
tagstr = asn1_tag[tag];
} else {
- snprintf(tagbuf, sizeof(tagbuf), "tag%d", tag);
+ g_snprintf(tagbuf, sizeof(tagbuf), "tag%d", tag);
tagstr = tagbuf;
}
if (def) {
- snprintf(lenbuf, sizeof(lenbuf), "%d", len);
+ g_snprintf(lenbuf, sizeof(lenbuf), "%d", len);
} else {
strncpy(lenbuf, "indefinite", sizeof(lenbuf));
}
@@ -2907,7 +2907,7 @@ tbl_typeref(guint n, GNode *pdu, GNode *tree, guint fullindex)
ss[0] = 0;
if (p->tclass==CLASSREF)
- snprintf(ss, 128, ", CLASSREF %d", p->tag);
+ g_snprintf(ss, 128, ", CLASSREF %d", p->tag);
if (asn1_verbose) g_message("%*sno typeref tag%s", n*2, empty, ss);
if (p->tclass==CLASSREF) {
@@ -4863,13 +4863,13 @@ proto_register_asn1(void) {
"ASN.1 messages will be read",
10, &global_sctp_port_asn1);
#else
- snprintf(tmpstr, sizeof(tmpstr), "%u", TCP_PORT_ASN1);
+ g_snprintf(tmpstr, sizeof(tmpstr), "%u", TCP_PORT_ASN1);
range_convert_str(&global_tcp_ports_asn1, tmpstr, 65535);
- snprintf(tmpstr, sizeof(tmpstr), "%u", UDP_PORT_ASN1);
+ g_snprintf(tmpstr, sizeof(tmpstr), "%u", UDP_PORT_ASN1);
range_convert_str(&global_udp_ports_asn1, tmpstr, 65535);
- snprintf(tmpstr, sizeof(tmpstr), "%u", SCTP_PORT_ASN1);
+ g_snprintf(tmpstr, sizeof(tmpstr), "%u", SCTP_PORT_ASN1);
range_convert_str(&global_sctp_ports_asn1, tmpstr, 65535);
prefs_register_range_preference(asn1_module, "tcp_ports",
diff --git a/plugins/ciscosm/packet-sm.c b/plugins/ciscosm/packet-sm.c
index fb719a053e..6dc593729e 100644
--- a/plugins/ciscosm/packet-sm.c
+++ b/plugins/ciscosm/packet-sm.c
@@ -53,10 +53,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <gmodule.h>
#include <epan/packet.h>
diff --git a/plugins/docsis/packet-vendor.c b/plugins/docsis/packet-vendor.c
index 9bb56402c2..2e341a7dd5 100644
--- a/plugins/docsis/packet-vendor.c
+++ b/plugins/docsis/packet-vendor.c
@@ -61,10 +61,6 @@
#include <gmodule.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* Define Vendor ID's here */
diff --git a/plugins/irda/packet-ircomm.c b/plugins/irda/packet-ircomm.c
index 0148f89747..20f2c96ded 100644
--- a/plugins/irda/packet-ircomm.c
+++ b/plugins/irda/packet-ircomm.c
@@ -39,9 +39,6 @@
#include <epan/packet.h>
#include <epan/proto.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
/*
* See
diff --git a/plugins/irda/packet-irda.c b/plugins/irda/packet-irda.c
index 53e50258d6..e3d607b010 100644
--- a/plugins/irda/packet-irda.c
+++ b/plugins/irda/packet-irda.c
@@ -44,10 +44,6 @@
#include <epan/conversation.h>
#include <epan/xdlc.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "irda-appl.h"
/*
@@ -838,7 +834,7 @@ static void dissect_iap_result(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ro
}
ti = proto_tree_add_item(tree, hf_iap_list_entry, tvb, offset, 2 + 1 + attr_len, FALSE);
- snprintf(buf, sizeof(buf) - 1, "%d", n + 1);
+ g_snprintf(buf, sizeof(buf) - 1, "%d", n + 1);
proto_item_append_text(ti, buf);
entry_tree = proto_item_add_subtree(ti, ett_iap_entry[n]);
@@ -1770,7 +1766,7 @@ static void dissect_irlap(tvbuff_t* tvb, packet_info* pinfo, proto_tree* root)
pinfo->circuit_id = a;
/* initially set address columns to connection address */
- snprintf(addr, sizeof(addr)-1, "0x%02X", a >> 1);
+ g_snprintf(addr, sizeof(addr)-1, "0x%02X", a >> 1);
if (check_col(pinfo->cinfo, COL_DEF_SRC))
col_add_str(pinfo->cinfo, COL_DEF_SRC, addr);
if (check_col(pinfo->cinfo, COL_DEF_DST))
diff --git a/plugins/opsi/packet-opsi.c b/plugins/opsi/packet-opsi.c
index b93e749bab..c18d368879 100644
--- a/plugins/opsi/packet-opsi.c
+++ b/plugins/opsi/packet-opsi.c
@@ -36,10 +36,6 @@
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/dissectors/packet-tcp.h>
#include <epan/prefs.h>
diff --git a/plugins/rlm/packet-rlm.c b/plugins/rlm/packet-rlm.c
index 8c9d9c6a5c..10f5a2d7b6 100644
--- a/plugins/rlm/packet-rlm.c
+++ b/plugins/rlm/packet-rlm.c
@@ -55,10 +55,6 @@
#include <stdlib.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <gmodule.h>
#include <epan/packet.h>
diff --git a/plugins/v5ua/packet-v5ua.c b/plugins/v5ua/packet-v5ua.c
index bdf0c494d6..f02901605b 100644
--- a/plugins/v5ua/packet-v5ua.c
+++ b/plugins/v5ua/packet-v5ua.c
@@ -50,10 +50,6 @@ G_MODULE_EXPORT const gchar version[] = VERSION;
#include "sctpppids.h" /* include V5UA payload protocol ID */
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
diff --git a/ringbuffer.c b/ringbuffer.c
index 4cfc637a3c..02c66138a2 100644
--- a/ringbuffer.c
+++ b/ringbuffer.c
@@ -69,10 +69,6 @@
#include <time.h>
#include <errno.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include "wiretap/wtap.h"
#include "ringbuffer.h"
@@ -127,7 +123,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err)
#endif
current_time = time(NULL);
- snprintf(filenum, sizeof(filenum), "%05d", rb_data.curr_file_num + 1 /*.number*/);
+ g_snprintf(filenum, sizeof(filenum), "%05d", rb_data.curr_file_num + 1 /*.number*/);
strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(&current_time));
rfile->name = g_strconcat(rb_data.fprefix, "_", filenum, "_", timestr,
rb_data.fsuffix, NULL);
diff --git a/tap-iousers.c b/tap-iousers.c
index 693dbe36f7..8ae39be983 100644
--- a/tap-iousers.c
+++ b/tap-iousers.c
@@ -79,20 +79,20 @@ iousers_udpip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
if(udph->uh_sport>udph->uh_dport){
direction=0;
- snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
- snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
} else if(udph->uh_sport<udph->uh_dport){
direction=1;
- snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
- snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
} else if(CMP_ADDRESS(&udph->ip_src, &udph->ip_dst)>0){
direction=0;
- snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
- snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
} else {
direction=1;
- snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
- snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&udph->ip_src),get_udp_port(udph->uh_sport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&udph->ip_dst),get_udp_port(udph->uh_dport));
}
for(iui=iu->items;iui;iui=iui->next){
@@ -137,21 +137,21 @@ iousers_sctp_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, cons
io_users_item_t *iui;
int direction=0;
- sprintf(s_sport,"%d",sctph->sport);
- sprintf(s_dport,"%d",sctph->dport);
+ g_snprintf(s_sport, sizeof s_sport, "%d",sctph->sport);
+ g_snprintf(s_dport, sizeof s_dport, "%d",sctph->dport);
if(sctph->sport > sctph->dport) {
direction=0;
- snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
- snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
+ g_snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
+ g_snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
} else if(sctph->sport < sctph->dport) {
direction=1;
- snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
- snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
+ g_snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
+ g_snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
} else {
direction=0;
- snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
- snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
+ g_snprintf(name1,256,"%s:%s",address_to_str(&sctph->ip_src),s_sport);
+ g_snprintf(name2,256,"%s:%s",address_to_str(&sctph->ip_dst),s_dport);
}
for(iui=iu->items;iui;iui=iui->next){
@@ -198,20 +198,20 @@ iousers_tcpip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
if(tcph->th_sport>tcph->th_dport){
direction=0;
- snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
- snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
} else if(tcph->th_sport<tcph->th_dport){
direction=1;
- snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
- snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
} else if(CMP_ADDRESS(&tcph->ip_src, &tcph->ip_dst)>0){
direction=0;
- snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
- snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
} else {
direction=1;
- snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
- snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
+ g_snprintf(name2,256,"%s:%s",address_to_str(&tcph->ip_src),get_tcp_port(tcph->th_sport));
+ g_snprintf(name1,256,"%s:%s",address_to_str(&tcph->ip_dst),get_tcp_port(tcph->th_dport));
}
for(iui=iu->items;iui;iui=iui->next){
diff --git a/tap-rpcprogs.c b/tap-rpcprogs.c
index 03ccd7ac3a..9a1980e170 100644
--- a/tap-rpcprogs.c
+++ b/tap-rpcprogs.c
@@ -205,7 +205,7 @@ rpcprogs_draw(void *dummy _U_)
td=0;
}
- sprintf(str,"%s(%d)",rpc_prog_name(rp->program),rp->program);
+ g_snprintf(str, sizeof(str), "%s(%d)",rpc_prog_name(rp->program),rp->program);
printf("%-15s %2d %6d %3d.%05d %3d.%05d %3d.%05d\n",
str,
rp->version,
diff --git a/tethereal.c b/tethereal.c
index db4ab4ac71..c25ee5a09c 100644
--- a/tethereal.c
+++ b/tethereal.c
@@ -51,10 +51,6 @@
# include <sys/stat.h>
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#ifdef NEED_STRERROR_H
#include "strerror.h"
#endif
@@ -1503,7 +1499,7 @@ capture(char *save_file, int out_file_type)
set_linktype_err_str = set_pcap_linktype(ld.pch, capture_opts.iface,
capture_opts.linktype);
if (set_linktype_err_str != NULL) {
- snprintf(errmsg, sizeof errmsg, "Unable to set data link type (%s).",
+ g_snprintf(errmsg, sizeof errmsg, "Unable to set data link type (%s).",
set_linktype_err_str);
goto error;
}
@@ -1517,7 +1513,7 @@ capture(char *save_file, int out_file_type)
users; don't warn about permissions problems.
Do, however, warn that WAN devices aren't supported. */
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check that you have the proper interface specified.\n"
"\n"
@@ -1556,7 +1552,7 @@ capture(char *save_file, int out_file_type)
"at the URL lists a number of mirror sites.";
else
libpcap_warn = "";
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"The capture session could not be initiated (%s).\n"
"Please check to make sure you have sufficient permissions, and that\n"
"you have the proper interface or pipe specified.%s", open_err_str,
@@ -1604,20 +1600,20 @@ capture(char *save_file, int out_file_type)
}
if (pcap_compile(ld.pch, &fcode, capture_opts.cfilter, 1, netmask) < 0) {
if (dfilter_compile(capture_opts.cfilter, &rfcode)) {
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"Unable to parse capture filter string (%s).\n"
" Interestingly enough, this looks like a valid display filter\n"
" Are you sure you didn't mix them up?",
pcap_geterr(ld.pch));
} else {
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
"Unable to parse capture filter string (%s).",
pcap_geterr(ld.pch));
}
goto error;
}
if (pcap_setfilter(ld.pch, &fcode) < 0) {
- snprintf(errmsg, sizeof errmsg, "Can't install filter (%s).",
+ g_snprintf(errmsg, sizeof errmsg, "Can't install filter (%s).",
pcap_geterr(ld.pch));
#ifdef HAVE_PCAP_FREECODE
pcap_freecode(&fcode);
@@ -1665,7 +1661,7 @@ capture(char *save_file, int out_file_type)
}
if (ld.pdh == NULL) {
- snprintf(errmsg, sizeof errmsg,
+ g_snprintf(errmsg, sizeof errmsg,
cf_open_error_message(err, NULL, TRUE, out_file_type),
*save_file == '\0' ? "stdout" : save_file);
goto error;
@@ -2876,7 +2872,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_UNSUPPORTED:
/* Seen only when opening a capture file for reading. */
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" isn't a capture file in a format Tethereal understands.\n"
"(%s)", err_info);
g_free(err_info);
@@ -2885,7 +2881,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_CANT_WRITE_TO_PIPE:
/* Seen only when opening a capture file for writing. */
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a pipe, and %s capture files can't be "
"written to a pipe.", wtap_file_type_string(file_type));
errmsg = errmsg_errno;
@@ -2900,7 +2896,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
if (for_writing)
errmsg = "Tethereal can't save this capture in that format.";
else {
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" is a capture for a network type that Tethereal doesn't support.\n"
"(%s)", err_info);
g_free(err_info);
@@ -2917,7 +2913,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
case WTAP_ERR_BAD_RECORD:
/* Seen only when opening a capture file for reading. */
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" appears to be damaged or corrupt.\n"
"(%s)", err_info);
g_free(err_info);
@@ -2941,7 +2937,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
break;
default:
- snprintf(errmsg_errno, sizeof(errmsg_errno),
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" could not be %s: %s.",
for_writing ? "created" : "opened",
wtap_strerror(err));
@@ -3014,7 +3010,7 @@ cf_open(capture_file *cf, const char *fname, gboolean is_tempfile, int *err)
return CF_OK;
fail:
- snprintf(err_msg, sizeof err_msg,
+ g_snprintf(err_msg, sizeof err_msg,
cf_open_error_message(*err, err_info, FALSE, 0), fname);
fprintf(stderr, "tethereal: %s\n", err_msg);
return CF_ERROR;
@@ -3078,7 +3074,7 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
if (errno == ENOENT || errno == ENOTDIR)
ldat->pipe_err = PIPNEXIST;
else {
- snprintf(errmsg, errmsgl,
+ g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated "
"due to error on pipe: %s", strerror(errno));
ldat->pipe_err = PIPERR;
@@ -3093,7 +3089,7 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
*/
ldat->pipe_err = PIPNEXIST;
} else {
- snprintf(errmsg, errmsgl,
+ g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated because\n"
"\"%s\" is neither an interface nor a pipe", pipename);
ldat->pipe_err = PIPERR;
@@ -3102,7 +3098,7 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
}
fd = open(pipename, O_RDONLY);
if (fd == -1) {
- snprintf(errmsg, errmsgl,
+ g_snprintf(errmsg, errmsgl,
"The capture session could not be initiated "
"due to error on pipe open: %s", strerror(errno));
ldat->pipe_err = PIPERR;
@@ -3118,9 +3114,9 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
b = read(fd, ((char *)&magic)+bytes_read, sizeof magic-bytes_read);
if (b <= 0) {
if (b == 0)
- snprintf(errmsg, errmsgl, "End of file on pipe during open");
+ g_snprintf(errmsg, errmsgl, "End of file on pipe during open");
else
- snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
+ g_snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
strerror(errno));
goto error;
}
@@ -3156,7 +3152,7 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
break;
default:
/* Not a "libpcap" type we know about. */
- snprintf(errmsg, errmsgl, "Unrecognized libpcap format");
+ g_snprintf(errmsg, errmsgl, "Unrecognized libpcap format");
goto error;
}
@@ -3167,9 +3163,9 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
sizeof(struct pcap_hdr) - bytes_read);
if (b <= 0) {
if (b == 0)
- snprintf(errmsg, errmsgl, "End of file on pipe during open");
+ g_snprintf(errmsg, errmsgl, "End of file on pipe during open");
else
- snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
+ g_snprintf(errmsg, errmsgl, "Error on pipe during open: %s",
strerror(errno));
goto error;
}
@@ -3185,7 +3181,7 @@ pipe_open_live(char *pipename, struct pcap_hdr *hdr, loop_data *ldat,
}
if (hdr->version_major < 2) {
- snprintf(errmsg, errmsgl, "Unable to read old libpcap format");
+ g_snprintf(errmsg, errmsgl, "Unable to read old libpcap format");
goto error;
}
@@ -3256,7 +3252,7 @@ pipe_dispatch(int fd, loop_data *ldat, struct pcap_hdr *hdr,
break;
default:
- snprintf(errmsg, errmsgl, "pipe_dispatch: invalid state");
+ g_snprintf(errmsg, errmsgl, "pipe_dispatch: invalid state");
result = PD_ERR;
} /* switch (ldat->pipe_state) */
@@ -3270,7 +3266,7 @@ pipe_dispatch(int fd, loop_data *ldat, struct pcap_hdr *hdr,
/* We've read the header. Take care of byte order. */
adjust_header(ldat, hdr, &rechdr->hdr);
if (rechdr->hdr.incl_len > WTAP_MAX_PACKET_SIZE) {
- snprintf(errmsg, errmsgl, "Frame %u too long (%d bytes)",
+ g_snprintf(errmsg, errmsgl, "Frame %u too long (%d bytes)",
ldat->packet_count+1, rechdr->hdr.incl_len);
break;
}
@@ -3294,7 +3290,7 @@ pipe_dispatch(int fd, loop_data *ldat, struct pcap_hdr *hdr,
return -1;
case PD_PIPE_ERR:
- snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
+ g_snprintf(errmsg, errmsgl, "Error reading from pipe: %s",
strerror(errno));
/* Fall through */
case PD_ERR:
diff --git a/util.c b/util.c
index 6eb8297a32..f6ed670b13 100644
--- a/util.c
+++ b/util.c
@@ -41,10 +41,6 @@
#include <sys/stat.h>
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#ifdef NEED_MKSTEMP
#include "mkstemp.h"
#endif
@@ -141,7 +137,7 @@ try_tempfile(char *namebuf, int namebuflen, const char *dir, const char *pfx)
/* Stick in a truncated name, so that if this error is
reported with the file name, you at least get
something. */
- snprintf(namebuf, namebuflen, "%s%s%s", dir, pfx, suffix);
+ g_snprintf(namebuf, namebuflen, "%s%s%s", dir, pfx, suffix);
errno = ENAMETOOLONG;
return -1;
}