GOOSE Messages don't use the length field to perform the dissection.
[obnox/wireshark/wip.git] / tap-follow.c
index 0d8a8d6ad4c3384cd8975c87c8a70a157e3ea05d..2b4013cc535399f34fdbb628e3caa0d0d14507b3 100644 (file)
@@ -46,6 +46,7 @@
 #include <epan/tap.h>
 #include <epan/tvbuff-int.h>
 
+#include "wsutil/file_util.h"
 #include "tempfile.h"
 
 WS_VAR_IMPORT FILE *data_out_file;
@@ -149,7 +150,7 @@ followStrFilter(
     switch (fp->type)
     {
     case type_TCP:
-      len = snprintf(filter, sizeof filter,
+      len = g_snprintf(filter, sizeof filter,
                      "tcp.stream eq %d", fp->index);
       break;
     case type_UDP:
@@ -165,7 +166,7 @@ followStrFilter(
     switch (fp->type)
     {
     case type_TCP:
-      len = snprintf(filter, sizeof filter,
+      len = g_snprintf(filter, sizeof filter,
                      "((ip%s.src eq %s and tcp.srcport eq %d) and "
                      "(ip%s.dst eq %s and tcp.dstport eq %d))"
                      " or "
@@ -177,7 +178,7 @@ followStrFilter(
                      verp, ip0, fp->port[0]);
       break;
     case type_UDP:
-      len = snprintf(filter, sizeof filter,
+      len = g_snprintf(filter, sizeof filter,
                      "((ip%s.src eq %s and udp.srcport eq %d) and "
                      "(ip%s.dst eq %s and udp.dstport eq %d))"
                      " or "
@@ -221,7 +222,7 @@ followFileClose(
 
   if (fp->filenamep != NULL)
   {
-    unlink(fp->filenamep);
+    ws_unlink(fp->filenamep);
     g_free(fp->filenamep);
     fp->filenamep = NULL;
   }
@@ -251,16 +252,16 @@ followFileOpen(
   fp->filenamep = g_strdup(tempfilep);
   if (fp->filenamep == NULL)
   {
-    close(fd);
-    unlink(tempfilep);
+    ws_close(fd);
+    ws_unlink(tempfilep);
     followExit("Error duping temp file name.");
   }
 
   fp->filep = fdopen(fd, "w+b");
   if (fp->filep == NULL)
   {
-    close(fd);
-    unlink(fp->filenamep);
+    ws_close(fd);
+    ws_unlink(fp->filenamep);
     g_free(fp->filenamep);
     fp->filenamep = NULL;
     followExit("Error opening temp file stream.");
@@ -365,7 +366,7 @@ followPrintHex(
     if ((ii % BYTES_PER_LINE) == 0)
     {
       /* new line */
-      sprintf(line, "%0*X", OFFSET_LEN, offset);
+      g_snprintf(line, LINE_LEN + 1, "%0*X", OFFSET_LEN, offset);
       memset(line + HEX_START - OFFSET_SPACE, ' ',
              HEX_LEN + OFFSET_SPACE + HEX_SPACE);
 
@@ -460,7 +461,7 @@ followDraw(
   rewind(fp->filep);
   for (chunk = 0;;)
   {
-    len = fread(&sc, 1, sizeof sc, fp->filep);
+    len = (guint32)fread(&sc, 1, sizeof sc, fp->filep);
     if (len != sizeof sc)
     {
       /* no data */
@@ -606,7 +607,7 @@ followDraw(
 
     for (;;)
     {
-      len = fread(&sc, 1, sizeof sc, fp->filep);
+      len = (guint32)fread(&sc, 1, sizeof sc, fp->filep);
       if (len != sizeof sc)
       {
         /* no more data */
@@ -635,7 +636,7 @@ followArgStrncmp(
   const char *  strp
   )
 {
-  int           len     = strlen(strp);
+  int           len     = (guint32)strlen(strp);
 
   if (strncmp(*optargp, strp, len) == 0)
   {