various code cleanup:
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 8 Aug 2005 18:50:39 +0000 (18:50 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 8 Aug 2005 18:50:39 +0000 (18:50 +0000)
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15264 f5534014-38df-0310-8fa8-9805f1628bb7

109 files changed:
capture_sync.c
disabled_protos.c
epan/addr_resolv.c
epan/asn1.c
epan/atalk-utils.c
epan/atalk-utils.h
epan/column-utils.c
epan/dfilter/dfilter.c
epan/dissectors/packet-afp.c
epan/dissectors/packet-amr.c
epan/dissectors/packet-aoe.c
epan/dissectors/packet-ber.c
epan/dissectors/packet-bgp.c
epan/dissectors/packet-brdwlk.c
epan/dissectors/packet-bssgp.c
epan/dissectors/packet-camel.c
epan/dissectors/packet-ccsds.c
epan/dissectors/packet-cip.c
epan/dissectors/packet-cpfi.c
epan/dissectors/packet-cpha.c
epan/dissectors/packet-csm-encaps.c
epan/dissectors/packet-dcerpc-samr.c
epan/dissectors/packet-dcerpc.c
epan/dissectors/packet-dcm.c
epan/dissectors/packet-dcom.c
epan/dissectors/packet-diameter.c
epan/dissectors/packet-dnp.c
epan/dissectors/packet-dns.c
epan/dissectors/packet-enip.c
epan/dissectors/packet-fc.c
epan/dissectors/packet-fcct.c
epan/dissectors/packet-fcdns.c
epan/dissectors/packet-fcels.c
epan/dissectors/packet-fcfcs.c
epan/dissectors/packet-fcfzs.c
epan/dissectors/packet-fclctl.c
epan/dissectors/packet-fcp.c
epan/dissectors/packet-fcsb3.c
epan/dissectors/packet-fcsp.c
epan/dissectors/packet-fcswils.c
epan/dissectors/packet-g723.c
epan/dissectors/packet-gprs-llc.c
epan/dissectors/packet-hyperscsi.c
epan/dissectors/packet-ieee80211.c
epan/dissectors/packet-igmp.c
epan/dissectors/packet-image-gif.c
epan/dissectors/packet-image-jfif.c
epan/dissectors/packet-ipdc.c
epan/dissectors/packet-ipv6.c
epan/dissectors/packet-ipvs-syncd.c
epan/dissectors/packet-ismp.c
epan/dissectors/packet-isns.c
epan/dissectors/packet-isup.c
epan/dissectors/packet-isup_thin.c
epan/dissectors/packet-jxta.c
epan/dissectors/packet-kerberos.c
epan/dissectors/packet-laplink.c
epan/dissectors/packet-ldap.c
epan/dissectors/packet-lwapp.c
epan/dissectors/packet-mdshdr.c
epan/dissectors/packet-msrp.c
epan/dissectors/packet-mtp3.c
epan/dissectors/packet-mtp3mg.c
epan/dissectors/packet-multipart.c
epan/dissectors/packet-ntp.c
epan/dissectors/packet-pflog.c
epan/dissectors/packet-pim.c
epan/dissectors/packet-pn-rt.c
epan/dissectors/packet-ptp.c
epan/dissectors/packet-rsvp.c
epan/dissectors/packet-rtps.c
epan/dissectors/packet-sccp.c
epan/dissectors/packet-sccpmg.c
epan/dissectors/packet-sebek.c
epan/dissectors/packet-sflow.c
epan/dissectors/packet-sigcomp.c
epan/dissectors/packet-sndcp.c
epan/dissectors/packet-stun.c
epan/dissectors/packet-uma.c
epan/dissectors/packet-wccp.c
epan/dissectors/packet-wsp.c
epan/dissectors/packet-wtls.c
epan/dissectors/packet-wtp.c
epan/filesystem.c
epan/follow.c
epan/inet_ntop.c
epan/ipproto.c
epan/plugins.c
epan/proto.c
epan/sigcomp-udvm.c
epan/sigcomp_state_hdlr.c
epan/to_str.c
epan/to_str.h
epan/value_string.c
filters.c
pcap-util-unix.c
plugins/asn1/packet-asn1.c
plugins/ciscosm/packet-sm.c
plugins/docsis/packet-vendor.c
plugins/irda/packet-ircomm.c
plugins/irda/packet-irda.c
plugins/opsi/packet-opsi.c
plugins/rlm/packet-rlm.c
plugins/v5ua/packet-v5ua.c
ringbuffer.c
tap-iousers.c
tap-rpcprogs.c
tethereal.c
util.c

index 1d1750b09fe87f39d0204f9c1200002fcfceac16..083a9f2669de05004d2bd73ffc10a73bb98127a3 100644 (file)
@@ -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;
   }
index 19045431dbcdd923e6441a02f4b43579c467df03..d8fbdf11b8a04dff96a149e9a6f7cf45b6aa03a0 100644 (file)
@@ -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;
index 32e83cf427625e95066631e92a96140862e5fb22..7700ec80f4415476fd539731b90712200c14823d 100644 (file)
@@ -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;
   }
 
index d3d9fc02f3d52220d882526a8706448d9cec3450..5d118479aad172036677e974d237cd7acf5ca881 100644 (file)
 
 #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;
     }
index 07a6471526b1477bd0f9364879369455d1247dc8..2d79be137dede8c86637c3a676881b9edbf27fce 100644 (file)
@@ -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 );
 }
index 74f5df263d14c54532b7304368ddf21b9fb345d1..5eed8a2362269f6b8c2d362b5ab4b1f2da96f1bb 100644 (file)
@@ -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
index 70f70055b57e3ef502cc6eae3161e39b8365014f..14d7097707128d7e53ff3d5ee33aefd05506398f 100644 (file)
 #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;
index 1657562e447857198c233e8cad7eac22e64e0b61..aca1562a446a09514c008217783f29c1bc519f3b 100644 (file)
 #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"
index 96300383a1a6a5fb22e617b9e8389b3d035217a3..8f95ea68a5cc049f46f075860b0509bbeddad397 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <string.h>
 #include <glib.h>
 #include <epan/packet.h>
index a6bc9745115b70b33edcf578f45f2d2ddcb32aa6..31fd1e8ac68cbcbc25e3c7b220ce252ad8d87034 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "prefs.h"
 
index 4605b7b1c38320126fea7f848e66fa472fb26eba..e0cfd48d508381132dad22f3b95d3fb849f2b3ff 100644 (file)
 #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>
index 7a5bffb5a6a53766e3040a775b539ddaae09efda..824129804d31c26f8c4a627fb0c595252b015e96 100644 (file)
@@ -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);
index 6ca5173532b2b33a19675c5c35f9367e1aec3edb..f1886c3f06562c8109b85c2a161afa9ef09fac50 100644 (file)
 #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 ;
index 1fce4130d8002c9a40faa71b6473839619670846..10545e8e53049be23096393ab518fe731c488714 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "etypes.h"
 
index 38a11acac9e52cfd0a248e7eb21d3dd3b909cbe7..7505215cccc340a45d10ddec8aec521e6fa91b8f 100644 (file)
@@ -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;
   }
 }
index e2d1ebebc916aa464dfd5f39d0aa2bb864998abc..bfa51ca1eead84ba7c58dfc32752da2cadd58d5f 100644 (file)
@@ -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*/
 
 
index ac1f6ca281dc46d1bcb16bdcb07a8ec0f790b3d2..cc9fc8a245f1ae7056fb1e365c18ffe2e0a6bb14 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 /*
index 76278f4db401a5d4c423623af9d43578ceec2ec0..21b9451027d01072521dd49cb4bdde3a672722d7 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <prefs.h>
 #include "packet-tcp.h"
index e1b22ca7d257a5c5d65a0000c5488c9d07124440..7f28e1abcbd2d6a118ddc883aea460e55a1ba4c7 100644 (file)
@@ -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. */
index 6ce650c535a38f2d189f35185065d85cf1ab6645..bcba0774d334d498ec7dc10b05ce4748a25a6137 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/ipproto.h>
 
index 73c2bb03fce766e6ee991e1ee6995f4a13fe6b49..a459d95c204beff717aa492f9e71ccdcdbce096a 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/prefs.h>
 #include <epan/reassemble.h>
index 4fe262b113ccc6dd4004a4ccaf5e2a9c681c3d3d..4527455675416e932f8b1f214d36e6a28b6a21b7 100644 (file)
 #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,
index e5d1b62649f094b07a17260598c20716d30ff6a7..f47caaa73f330f9f036225defef3494fa7f362bd 100644 (file)
@@ -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);
                }
index a846332068a153625b74fd621e3c2006e5a54ab2..95ed785941a70c2ef610430ce5cd483c4954a6b2 100644 (file)
 
 #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" : "",
index 33623ed8c70728ef1530517fd1b4605dc78b12b2..b64d1150c45c7d48178e620637f41aebd8f8cb4d 100644 (file)
@@ -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],
index 20f6eeb3ae5597af342ecbb44f23a5a093a50ec8..0853412b8efd97154a6852834f73b45abbdf62a9 100644 (file)
 #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 */
 
index f0c433b65de25993f9cad5361dd7a7123e04e621..f962129dc3c45e8de96f49666f509f6232c3075b 100644 (file)
 #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);
 
 
index 12333373e3c6b4207e796bf587209c3eebf4033e..f0788d3d687b0c6437325b5130860dc48a6660b5 100644 (file)
@@ -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;
 }
 
index 3a0ede14a2b769158e3983cd07419c9e32031a3d..9c7a89c0ac54ca72cf7a2ec367400294c7c52ab8 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <prefs.h>
 #include "packet-tcp.h"
index efab45c62c71aad47365c2936e7bbe4b86b8af17..7ab8cf9d3f45cf0bbc5dac4478a9c1db4f00285c 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/prefs.h>
 #include <epan/reassemble.h>
index 269edacd97df5b4910bf8b3c675917bd29632e66..d938c8fe1660e1b4062c4e0e7313dcbcda4c3c64 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "etypes.h"
 #include "packet-fc.h"
index f3765350d15d37eba181d32eff372a60af4d0ab7..ce9cbf0dce703cf9a21ab4df01bc5a209c2f32c2 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include "etypes.h"
index b576ee0a4a82ea0f02df0e49b7b376ca86df04c3..54964ab1f0bbe0422c9ef9cc923e7d8357f3e769 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include "etypes.h"
index 30f30e018a8692b239230f6190f736350f10e7cb..a974bf12e8310b7d384d8b9174cd280962d4d6a2 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include "etypes.h"
index 90afbfc6ace6f729997c16e4a8fdc55b36ecc6ac..b1284726f23bb59e4b84bfb4d35d9c56649c0127 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include "etypes.h"
index 446585c4244ec978270d1e60f1775d36794c5d5d..f635c17f4df466268899b6276fb5978c57320fb3 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "etypes.h"
 #include "packet-fc.h"
index 247c55923ce9476955c402ff0cb7dd8e356cbd9b..47b463347b72fca9450312e67de9ca627debe5cf 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/prefs.h>
 #include <epan/packet.h>
 #include <epan/conversation.h>
index 2c538a64a77c5b76b0583984160adc13b4719fc1..d3850119d5515a960b9ca042c01f2cc81307bad8 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/prefs.h>
 #include <epan/packet.h>
 #include <epan/conversation.h>
index 374d3c7d15be227f32af7aa8747dfe8047ae877d..954e2518ff73f0e06b42cc5015eaceff46ba4b00 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/prefs.h>
 #include <epan/packet.h>
 #include <epan/conversation.h>
index 85dacacad5302aa90ccb4b88bf376225d0fa3cea..046a01f1d1d025bff955175e697cf62f0d940bbd 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include "etypes.h"
index 673417ac9914ddf15d0c815d74b7c41d11bbb3af..d5598324c60ab2a99ec7186a2c70289b6508fd34 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "rtp_pt.h"
 
index ed21f1a0cf12ef01d0014a8715907e69def58c30..a8330a2d52e7ed89fbdbaf8003537e5e89b15934 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "prefs.h"
 
index fb7856c9843cf30cb3e796ab81f91755fbefb2ba..23f057d894935bf220cd198c126bb7bba352964f 100644 (file)
 #include <string.h>
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 static int proto_hyperscsi;
index da53e41d907e32bc3cbdd2f09f858194746948d8..9dce2337cb83fcd3a335fdeb335b371cb9b85ead 100644 (file)
@@ -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],
index 8613976b71ee1a8e5df6cac0753bd519eda8df16..0a06e89a3f7450c6cae9187467f433dcd0a3826a 100644 (file)
 #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)
index 4eefe72635a73277b1b1c60b45005e09930b2db3..16819c1202493cf0c4e52192f349d3f2be0201b0 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 /* General-purpose debug logger.
index a05e5de3d8c12c5c3a66e09a18741b246b4ff228..2040e79401fac5b01346fa5d2fc82d9f24925c0e 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 /* General-purpose debug logger.
index adaefbc04156d60d044dee1f18509d687b1e36d5..36f0681c2c984b495fa773888994b4b2166c647e 100644 (file)
 #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"
index 5e0a0135e62e2c279c9799e8960aa62106409ee1..5371b9e0c8cfa26418b57b02650fd3897326f4e6 100644 (file)
@@ -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 {
index 3b974beb234934cdbc7d5dcd48c8964642f296b2..01ad34a81ca2340380147858fdd71831dc318927 100644 (file)
 #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>
index 1076ce44f52fc7f2a773f750d93126807c080c21..e5242ea7942e6f1d39b7ddc72ffd7e730ca51e04 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/strutil.h>
 #include "etypes.h"
index f68da333b931b1d9d405d7ff974efd472e498b23..163426b7a1b25a9b9abcf66b44e1fcd92a8a7f25 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/conversation.h>
 #include "packet-tcp.h"
index e618be25521863e7113c8fd7a7b685f2dfb5a9ab..a83f58b88b43c890bb09dca258b17d29247fc3e8 100644 (file)
@@ -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);
index a60fa59811193ab59b5e7cf2537efb1cce317b46..192615ca5caffd94a5b355acd54030b25b6f1a52 100644 (file)
 #include <glib.h>
 #include <epan/conversation.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "prefs.h"
 
index e4c2cf61cbd1cc522eaa3147a9d707d8ad5d874b..fcabe44d690373e320c4de2577e5b608fe7c0b40 100644 (file)
@@ -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 );
index 53a9293a3d68447bdb9369a68e391301e7eb6f55..740b2bd35b54aa96f18bc6ba72c2f12ebde619fe 100644 (file)
@@ -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;
index 2f737ba28d3633dec9d128d108cb316b5b22e539..9f022950748c9e7f117ceabeb3b56559313e6103 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/strutil.h>
 #include <epan/conversation.h>
index 18002257001ff8bf14ed5c98bce254b075a701ec..b54550225d7224c73654fa09bb7c7413a1f4ffc2 100644 (file)
 #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);
 
index 8d5e55ed402f7499b5f006a7e650463277b0c5ca..b0eb8360c85adea852793c8c7934efe8acdfd51c 100644 (file)
 #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
index 794ee6f3722b45db8da42e153bbdc514115de65d..e12de8e205cda1dc8950833e53ea13ef0ddb3352 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/value_string.h>
 #include <etypes.h>
 #include <epan/packet.h>
index 31b26fcae21921d16d5c0993b7726144f7db5780..b9ba83fa0ddf3e71343efec36ae01fbf00d9fe8c 100644 (file)
 #include <glib.h>
 #include <epan/conversation.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "prefs.h"
 
index 7c196c3a927d78cdf3cd55e5c332fd73856601e4..6a5d55f26d5c466af363fbb79a568673bfa0cbdb 100644 (file)
 #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>
index 5eab60dd4265ebe72cb9513e7219cb07a66428b9..692ac73182ce30ae04d6109b3902bb3fa1a9adb7 100644 (file)
 
 #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));
index f7f113411c1ac6893c1437f4526eaad533048a3c..5fda13e7ecf00baca1cccde5e074edcbacdf955e 100644 (file)
 #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
index 3629f1adcd6417f86c99c3485f1f664f9afe81a6..aa13cfc9de744f8ca925c79875260071879ddcf0 100644 (file)
 #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++) {
index 2412068a8d89e25e1afef4e20130efb7109e3f95..197b166a6c890c599e59bdeca6c610ca4f7f6f6d 100644 (file)
@@ -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) {
index ac0408c16e8caae2c1a88fb8fbde0ee3f5e94bd5..768c37d51d0219f84fbccc4236d9b161d6a670d1 100644 (file)
@@ -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" : "",
index 0832e88a826457da934967f329988c3e1118f517..646d785428e65b39effa5052f36eaa93bd809e4e 100644 (file)
@@ -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);
 
index 89763b1496af89f4fe46c2991f08063208845d63..da37752cd578657bf728208bb2bc7956d5e2e15e 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 
index 6811a5aa544d5cd29a554a1a3db3be70b0e6e45e..0341871ae6a88b61c67477d46b876c3ed85f9966 100644 (file)
 
 #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;
index ac56796c1f883cb6aa1f465a97a7e3a8a142784d..538e930a7c089589c22df1fe3c57cdc42d6b792b 100644 (file)
 # include "config.h"
 #endif
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include  <stdio.h>
 #include  <stdlib.h>
 #include  <string.h>
index aae0dbb116418bc00289ff0580508166ec23e945..9a3a06efca9924049ae7e07cb4f78ceaed972810 100644 (file)
 
 #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));
 
index a0f90fcdbaaa5e5c9919ef7f6c87593d1ef2bef7..26d836e2123ef910e6cf4680910ce4a22a5dee26 100644 (file)
 
 #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));
index 959e03c7fd93fb7a8c611d9f207892ff3e8edb94..5646847d8c40946f3b27794a9c1f4ddff731550b 100644 (file)
 #include <math.h>
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/addr_resolv.h>
 
index aedb28796cfae2d1dec582d27c134650d32d675f..57ffcd8d4aa9f3a3ad410e119cb0eb97dfd3ba70 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 /*#include "packet-sflow.h"*/
 
index b4055fbb149266135b6677b8aa2bf28f35e628ca..69eb33be6c2c7cbe5b4f4e1448a6a0a34a8843ff 100644 (file)
 #include <math.h>
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include "prefs.h"
 #include "strutil.h"
index 91ae6cc2cafe7141072c1c4e2d6f485be3b69a9a..9736d35a61f810c01447787bb6bd7ba61afd4512 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 #include <epan/reassemble.h>
 
index 8b9f5317d5b3033eae06b0501cfae32fb514e25c..5bdf225198750048cfe9165be96b7932f1586832 100644 (file)
 
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 /* Initialize the protocol and registered fields */
index 12a4bbb8882a3cef4796f449f7a776c7912b55db..b4a3f5aebf9310251f46b7302bb37b528fb68959 100644 (file)
 #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"
index ef5d89fb62aae249858cd3b67e8cdb875ae1d7cb..bcd8d6a79fdbf44d69e9871e6658e92c224cc516 100644 (file)
 #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)];
                }
        }
index b146439b11b5e6729e2d0c48670c470e7fe8a007..cdb518647dde20944985269f53e6f6b3cdef7bd0 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <string.h>
 #include <glib.h>
 #include <epan/packet.h>
index 8ce0374af62ce325e79497b78ee64fa82a98a76a..9995cb6aa69bba9c6254b7e7d12e3376e7d070dd 100644 (file)
 #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));
                                        }
                                 }
index 36649ead4c9b1a7b4e25d5dea41cb580f4846a3f..1a71192465a37474fad51da74381a354efa729fc 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <string.h>
 #include <glib.h>
 #include <epan/packet.h>
index f87644969d1ebdbedc82422f04d570bfc45f2270..d042e426c67b7b1a767051a3bf6b4cd81dc5c744 100644 (file)
@@ -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;
index 429e0773387eccd277d94dc69533f31e2bfec4e6..f1dc7ccbad0770dd2e8abd12fe37e52e53482590 100644 (file)
@@ -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);
index 65b4db3a44091744e11f8f9229f79add5a423c02..1d32204cccfcad0b67a663352ed38e565418401a 100644 (file)
@@ -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);
index 77d9bb4702b7eed4de5c84a8021ed9664ca13763..69f317d86f69054365911cc3c6c531277f426a93 100644 (file)
 #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;
 }
index f9b3e201c04ef0ee3e1cdc05db4471f9790f5002..b4f665b3696b751c14b088196522c547fc1c5234 100644 (file)
 # 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)
index 803fe2feefc8d4fb6c48c92aa1a5cd1e65071a8f..caeebfe5f100ce09a09b5488c80ca3fb8813293b 100644 (file)
@@ -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);
 }
 
index 57b1234cac34adde6bfc59be42c9bbb7c485ca1d..fa904c458f8948094d14818e719ef958e2817df9 100644 (file)
 #include <string.h>
 #include <glib.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include "packet.h"
 #include "strutil.h"
 #include "sigcomp-udvm.h"
index 2909a58bbf623d969ed98698c4fa3ca855461af0..ef1d8c0e68f551c3f733c3e43560cb7d11ae5a82 100644 (file)
 #include <glib.h>
 #include "strutil.h"
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include "packet.h"
 #include "sigcomp_state_hdlr.h"
 /*
index 6ccdd4bcbc726d27cea640104ada80806e3f413b..e678246b018de5fcd1f11077ef6bfd39ec18e5fa 100644 (file)
 # 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;
index 0035ac1b719d0ee17a7a47025723f36d51a45a85..3f49ea6178fe18ae066c03479f7bb16a75d39c76 100644 (file)
@@ -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 *);
index d2874379de1fb9f662fd8cc746eb73743a421bc0..45daa541841d5e99aa3018f6d5e12bf3504c1e96 100644 (file)
@@ -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;
 }
 
index e8aa3cb33facff30b0816fad75866a261a31e7e5..f24f1d30c801ffbdcf41c6e4b22ca8969c2581a0 100644 (file)
--- 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;
index ae14754abad25be000578b105c4ce81ae4fba23d..9f4a6798d74cffda07c42f7d0e7edcfcdf6a8b90 100644 (file)
@@ -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;
                }
index 22b54558d0d3bcdecbb57f45357e293c992fc725..1e965e00cb2101e967cceceb4ccce186321bf1fb 100644 (file)
@@ -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",
index fb719a053e46edaa94765754b74d41286cb4fd65..6dc593729ea40a9e2c72bc935720d8d057ba31d2 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <gmodule.h>
 #include <epan/packet.h>
 
index 9bb56402c2d6e836969449b5a578fd5e170567e5..2e341a7dd5376a505abf2288ead516202817f82e 100644 (file)
 
 #include <gmodule.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <epan/packet.h>
 
 /* Define Vendor ID's here */
index 0148f897472930531d101d4b1f7cba701b5b5b87..20f2c96dedda63604ae6dca20d4aef4680695a06 100644 (file)
@@ -39,9 +39,6 @@
 #include <epan/packet.h>
 #include <epan/proto.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
 
 /*
  * See
index 53e50258d667521ccd010ff99c99034ef11bfdc9..e3d607b01064270da616a327c7039c9daa107888 100644 (file)
 #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))
index b93e749babb7f4b4aa0234b29fc9ace6abf2fcf1..c18d368879ba564914e087ca8deb0dd9f58bcf4d 100644 (file)
 
 #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>
index 8c9d9c6a5cd8d982c388d6f8c9d32199da77a9e4..10f5a2d7b6480be481b39ca0ea453555645f91b0 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef NEED_SNPRINTF_H
-# include "snprintf.h"
-#endif
-
 #include <gmodule.h>
 #include <epan/packet.h>
 
index bdf0c494d614c3671b522c682322d1d06db14a11..f02901605bad0f15e73c386e61640aaab79cbaf5 100644 (file)
@@ -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>
 
 
index 4cfc637a3c4a0e204095d5a49d404216178e46a0..02c66138a23b25b6d146cda539365f8ad62bb242 100644 (file)
 #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);
index 693dbe36f7f7bd8012613f1b2b0cf21316962152..8ae39be9839293ad1fe40b612aed8714eb740071 100644 (file)
@@ -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){
index 03ccd7ac3aeac65d9677d12b41475b82bcc58eb3..9a1980e1707be72299669e9fdfb9e29c7460c7e5 100644 (file)
@@ -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,
index db4ab4ac71d9e595e838b83fcf85ab3f0fcba286..c25ee5a09c55324e5883101b148cebc8913f83c3 100644 (file)
 # 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 6eb8297a322ac4290cd8e1e7bed8491d7b458ff9..f6ed670b13be13d003cade19dee5da1d35194208 100644 (file)
--- a/util.c
+++ b/util.c
 #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;
        }