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
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);
}
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);
}
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);
}
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);
}
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);
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;
}
/* 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;
* 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);
}
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);
} else {
cur = &str[0][0];
}
- sprintf(cur, "%u", port);
+ g_snprintf(cur, MAXNAMELEN, "%u", port);
return cur;
}
} else {
cur = &str[0][0];
}
- sprintf(cur, "%u", port);
+ g_snprintf(cur, MAXNAMELEN, "%u", port);
return cur;
}
} else {
cur = &str[0][0];
}
- sprintf(cur, "%u", port);
+ g_snprintf(cur, MAXNAMELEN, "%u", port);
return cur;
}
} 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;
}
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/tvbuff.h>
#include <epan/asn1.h>
break;
default:
- snprintf(errstrbuf, sizeof errstrbuf, "Unknown error (%d)", err);
+ g_snprintf(errstrbuf, sizeof errstrbuf, "Unknown error (%d)", err);
errstr = errstrbuf;
break;
}
} 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 );
}
*/
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
#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"
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,
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,
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;
}
}
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;
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;
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;
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;
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]);
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);
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);
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);
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);
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);
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;
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;
#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"
#include <stdio.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
#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>
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);
#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"
/* 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 ;
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "etypes.h"
}
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) {
}
if (use_default_ie_name) {
/* Memory has been allocated; free it */
- g_free(ie->name);
+ g_free( (gpointer) ie->name);
ie->name = NULL;
}
}
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';
0,
7,
time);
- free (time);
+ g_free (time);
return 7; /* 7 octetes eaten*/
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/*
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <prefs.h>
#include "packet-tcp.h"
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! */
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. */
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/ipproto.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
#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;
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,
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);
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,
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,
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],
{
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);
}
#include "isprint.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/conversation.h>
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;
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;
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),
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" : "",
} 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],
#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 */
}
}
- snprintf(buffer, sizeof(buffer),
+ g_snprintf(buffer, sizeof(buffer),
"Vendor 0x%08x", vendorId);
return buffer;
} /*diameter_vendor_to_str */
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:
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;
}
}
}
- snprintf(buffer, sizeof(buffer), "Unknown");
+ g_snprintf(buffer, sizeof(buffer), "Unknown");
return buffer;
} /*diameter_app_to_str */
#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>
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);
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]))
}
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;
}
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <prefs.h>
#include "packet-tcp.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/reassemble.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "etypes.h"
#include "packet-fc.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "etypes.h"
#include "packet-fc.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/prefs.h>
#include <epan/packet.h>
#include <epan/conversation.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "etypes.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "rtp_pt.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
static int proto_hyperscsi;
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],
#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>
*/
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)
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* General-purpose debug logger.
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* General-purpose debug logger.
#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"
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 {
#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>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/strutil.h>
#include "etypes.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/conversation.h>
#include "packet-tcp.h"
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);
#include <glib.h>
#include <epan/conversation.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
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 );
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 );
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;
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/strutil.h>
#include <epan/conversation.h>
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/asn1.h>
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);
#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
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/value_string.h>
#include <etypes.h>
#include <epan/packet.h>
#include <glib.h>
#include <epan/conversation.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
#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>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/prefs.h>
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));
#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
#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"
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,
*/
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++) {
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) {
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;
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;
}
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;
}
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" : "",
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",
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);
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/tvbuff.h>
#include <epan/packet.h>
#include <prefs.h>
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;
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;
# include "config.h"
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "packet-mtp3.h"
#include <epan/prefs.h>
/* 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));
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "packet-mtp3.h"
/* 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));
#include <math.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/addr_resolv.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/*#include "packet-sflow.h"*/
#include <math.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include "prefs.h"
#include "strutil.h"
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <epan/reassemble.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* Initialize the protocol and registered fields */
#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"
#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 */
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)];
}
}
#include <stdio.h>
#include <stdlib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
#include <stdio.h>
#include <stdlib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
{
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));
}
}
#include <stdio.h>
#include <stdlib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
/*
* 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
*/
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
} 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;
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) {
* 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) {
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 */
*/
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);
}
/*
#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));
#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;
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),
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),
is_ipv6 = TRUE;
}
else {
- g_free( buf );
return NULL;
}
memcpy(ip_address[0], pi->net_src.data, len);
#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
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);
#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" },
s = "Unknown";
ok:
- snprintf(buf, sizeof(buf), "%s", s);
+ g_snprintf(buf, sizeof(buf), "%s", s);
return buf;
}
# include "config.h"
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "plugins.h"
#ifdef HAVE_PLUGINS
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 */
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)
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);
}
#include <string.h>
#include <glib.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "packet.h"
#include "strutil.h"
#include "sigcomp-udvm.h"
#include <glib.h>
#include "strutil.h"
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "packet.h"
#include "sigcomp_state_hdlr.h"
/*
# 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
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;
}
}
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;
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;
}
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);
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);
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);
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;
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 *);
#include <stdio.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
#include "to_str.h"
#include "value_string.h"
} else {
cur = &str[0][0];
}
- snprintf(cur, 64, fmt, val);
+ g_snprintf(cur, 64, fmt, val);
return cur;
}
/* 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;
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;
}
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;
}
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;
}
int newlen = len;
if ( ! def) {
- snprintf(lenstr, strmax, "indefinite");
+ g_snprintf(lenstr, strmax, "indefinite");
return len;
}
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;
}
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 */
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,
);
} 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 */
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,
}
} 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)
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! */
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);
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 */
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));
}
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) {
"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",
#include <stdlib.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <gmodule.h>
#include <epan/packet.h>
#include <gmodule.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
/* Define Vendor ID's here */
#include <epan/packet.h>
#include <epan/proto.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
/*
* See
#include <epan/conversation.h>
#include <epan/xdlc.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include "irda-appl.h"
/*
}
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]);
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))
#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>
#include <stdlib.h>
#include <string.h>
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <gmodule.h>
#include <epan/packet.h>
#include "sctpppids.h" /* include V5UA payload protocol ID */
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#include <epan/packet.h>
#include <time.h>
#include <errno.h>
-#ifdef NEED_SNPRINTF_H
-#include "snprintf.h"
-#endif
-
#include "wiretap/wtap.h"
#include "ringbuffer.h"
#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(¤t_time));
rfile->name = g_strconcat(rb_data.fprefix, "_", filenum, "_", timestr,
rb_data.fsuffix, NULL);
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){
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){
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){
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,
# include <sys/stat.h>
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#ifdef NEED_STRERROR_H
#include "strerror.h"
#endif
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;
}
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"
"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,
}
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);
}
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;
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);
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;
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);
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);
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));
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;
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;
*/
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;
}
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;
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;
}
break;
default:
/* Not a "libpcap" type we know about. */
- snprintf(errmsg, errmsgl, "Unrecognized libpcap format");
+ g_snprintf(errmsg, errmsgl, "Unrecognized libpcap format");
goto error;
}
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;
}
}
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;
}
break;
default:
- snprintf(errmsg, errmsgl, "pipe_dispatch: invalid state");
+ g_snprintf(errmsg, errmsgl, "pipe_dispatch: invalid state");
result = PD_ERR;
} /* switch (ldat->pipe_state) */
/* 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;
}
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:
#include <sys/stat.h>
#endif
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
#ifdef NEED_MKSTEMP
#include "mkstemp.h"
#endif
/* 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;
}