Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
authorGuy Harris <guy@alum.mit.edu>
Tue, 13 Dec 2011 09:53:50 +0000 (09:53 -0000)
committerGuy Harris <guy@alum.mit.edu>
Tue, 13 Dec 2011 09:53:50 +0000 (09:53 -0000)
form of corruption/bogosity in a file, including in a file header as
well as in records in the file.  Change the error message
wtap_strerror() returns for it to reflect that.

Use it for some file header problems for which it wasn't already being
used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only
be used for files that we have no reason to believe are invalid but that
have a version number we don't know about or some other
non-link-layer-encapsulation-type value we don't know about.

svn path=/trunk/; revision=40175

47 files changed:
capinfos.c
capture_info.c
editcap.c
file.c
mergecap.c
rawshark.c
tshark.c
wiretap/5views.c
wiretap/aethra.c
wiretap/airopeek9.c
wiretap/ascendtext.c
wiretap/ber.c
wiretap/btsnoop.c
wiretap/commview.c
wiretap/cosine.c
wiretap/csids.c
wiretap/daintree-sna.c
wiretap/dbs-etherwatch.c
wiretap/dct3trace.c
wiretap/erf.c
wiretap/etherpeek.c
wiretap/eyesdn.c
wiretap/hcidump.c
wiretap/i4btrace.c
wiretap/ipfix.c
wiretap/iptrace.c
wiretap/iseries.c
wiretap/k12.c
wiretap/k12text.l
wiretap/lanalyzer.c
wiretap/libpcap.c
wiretap/netmon.c
wiretap/netscreen.c
wiretap/nettl.c
wiretap/network_instruments.c
wiretap/ngsniffer.c
wiretap/packetlogger.c
wiretap/pcap-common.c
wiretap/pcapng.c
wiretap/pppdump.c
wiretap/snoop.c
wiretap/tnef.c
wiretap/toshiba.c
wiretap/visual.c
wiretap/vms.c
wiretap/wtap.c
wiretap/wtap.h

index b2e0d4ea98dd14c41c1acc1ccd6714bed5ccce43..c2f2e8ed4c04da18cc7eb57256684514bc7fbf98 100644 (file)
@@ -658,7 +658,7 @@ process_cap_file(wtap *wth, const char *filename)
 
     case WTAP_ERR_UNSUPPORTED:
     case WTAP_ERR_UNSUPPORTED_ENCAP:
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
     case WTAP_ERR_DECOMPRESS:
       fprintf(stderr, "(%s)\n", err_info);
       g_free(err_info);
@@ -1078,7 +1078,7 @@ main(int argc, char *argv[])
 
       case WTAP_ERR_UNSUPPORTED:
       case WTAP_ERR_UNSUPPORTED_ENCAP:
-      case WTAP_ERR_BAD_RECORD:
+      case WTAP_ERR_BAD_FILE:
         fprintf(stderr, "(%s)\n", err_info);
         g_free(err_info);
         break;
index 0856cee2f6692772f036aa106d01ff4409129097..48102d94749042bf13ac0f8a6568934805c531e2 100644 (file)
@@ -160,7 +160,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
                 errmsg = "The file \"%s\" is a capture for a network type that TShark doesn't support.";
             break;
 
-        case WTAP_ERR_BAD_RECORD:
+        case WTAP_ERR_BAD_FILE:
             /* Seen only when opening a capture file for reading. */
             g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                        "The file \"%%s\" appears to be damaged or corrupt.\n"
index 67badb1f62962f7979ea6a134d3e65d924848a39..a36dfa995834cb44dc40641aea43990a75a80d60 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -1086,7 +1086,7 @@ main(int argc, char *argv[])
 
     case WTAP_ERR_UNSUPPORTED:
     case WTAP_ERR_UNSUPPORTED_ENCAP:
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       fprintf(stderr, "(%s)\n", err_info);
       g_free(err_info);
       break;
@@ -1481,7 +1481,7 @@ main(int argc, char *argv[])
 
       case WTAP_ERR_UNSUPPORTED:
       case WTAP_ERR_UNSUPPORTED_ENCAP:
-      case WTAP_ERR_BAD_RECORD:
+      case WTAP_ERR_BAD_FILE:
         fprintf(stderr, "(%s)\n", err_info);
         g_free(err_info);
         break;
diff --git a/file.c b/file.c
index f63abd69c631fd2c3a8d8e2dd6f9eaedc737ab92..c87d5dbb4b3ae278946b45089c427165da02803b 100644 (file)
--- a/file.c
+++ b/file.c
@@ -709,7 +709,7 @@ cf_read(capture_file *cf, gboolean from_save)
         " in the middle of a packet.";
       break;
 
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                  "The capture file appears to be damaged or corrupt.\n(%s)",
                  err_info);
@@ -1392,7 +1392,7 @@ cf_merge_files(char **out_filenamep, int in_file_count,
                    " in the middle of a packet.";
           break;
 
-        case WTAP_ERR_BAD_RECORD:
+        case WTAP_ERR_BAD_FILE:
           g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                      "The capture file %%s appears to be damaged or corrupt.\n(%s)",
                      err_info);
@@ -1577,7 +1577,7 @@ cf_read_frame_r(capture_file *cf, frame_data *fdata,
       g_free(err_info);
       break;
 
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                  "An error occurred while reading from the file \"%%s\": %s.\n(%s)",
                  wtap_strerror(err), err_info);
@@ -3923,7 +3923,7 @@ cf_open_failure_alert_box(const char *filename, int err, gchar *err_info,
       }
       break;
 
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       /* Seen only when opening a capture file for reading. */
       simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
             "The file \"%s\" appears to be damaged or corrupt.\n"
index 997613c31abcbfdf756464d2bae7156881191e0d..0061622b956a526f76254ccfd4aa6e81b71c04ee 100644 (file)
@@ -276,7 +276,7 @@ main(int argc, char *argv[])
 
     case WTAP_ERR_UNSUPPORTED:
     case WTAP_ERR_UNSUPPORTED_ENCAP:
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       fprintf(stderr, "(%s)\n", err_info);
       g_free(err_info);
       break;
@@ -417,7 +417,7 @@ main(int argc, char *argv[])
 
         case WTAP_ERR_UNSUPPORTED:
         case WTAP_ERR_UNSUPPORTED_ENCAP:
-        case WTAP_ERR_BAD_RECORD:
+        case WTAP_ERR_BAD_FILE:
           fprintf(stderr, "(%s)\n", err_info);
           g_free(err_info);
           break;
index e694fa2ef3be887efb4f2fe24f193d44c6208576..e900257d139bfc183c15641839948087bbc7db40 100644 (file)
@@ -939,7 +939,7 @@ raw_pipe_read(struct wtap_pkthdr *phdr, guchar * pd, int *err, const gchar **err
     printf("len: %d (%04x)\n", hdr.len, hdr.len);
 #endif
     if (bytes_needed > WTAP_MAX_PACKET_SIZE) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         g_snprintf(err_str, 100, "Bad packet length: %d (%04x)", bytes_needed, bytes_needed);
         *err_info = err_str;
         return FALSE;
@@ -996,7 +996,7 @@ load_cap_file(capture_file *cf)
                            cf->filename);
                 break;
 
-            case WTAP_ERR_BAD_RECORD:
+            case WTAP_ERR_BAD_FILE:
                 cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)",
                            cf->filename, err_info);
                 break;
index 375e5a8b430c35b9a5f50ccc1e0ef8e91c6cd6e2..d33aa3b7116143cb6c07322bf59f1735fbebc2f9 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -2933,7 +2933,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
                  cf->filename);
       break;
 
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       cmdarg_err("The file \"%s\" appears to be damaged or corrupt.\n(%s)",
                  cf->filename, err_info);
       g_free(err_info);
@@ -3674,7 +3674,7 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
         errmsg = "The file \"%s\" is a capture for a network type that TShark doesn't support.";
       break;
 
-    case WTAP_ERR_BAD_RECORD:
+    case WTAP_ERR_BAD_FILE:
       /* Seen only when opening a capture file for reading. */
       g_snprintf(errmsg_errno, sizeof(errmsg_errno),
                "The file \"%%s\" appears to be damaged or corrupt.\n"
index 7fd391cbbbfc36efa852a47d63f2bb909e483551..eb8879813d7f82dd8bd777eb05a9ba20afbb33b1 100644 (file)
@@ -245,7 +245,7 @@ _5views_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("5views: File has %u-byte packet, bigger than maximum of %u",
                    packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
index 912e94ddabfba065244c23cfb1792d9f4ee24392..ae53423785a311b787bf310424e8ad96711a2982 100644 (file)
@@ -215,7 +215,7 @@ static gboolean aethra_read(wtap *wth, int *err, gchar **err_info,
                rec_size = pletohs(hdr.rec_size);
                if (rec_size < (sizeof hdr - sizeof hdr.rec_size)) {
                        /* The record is shorter than a record header. */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("aethra: File has %u-byte record, less than minimum of %u",
                            rec_size, (unsigned int)(sizeof hdr - sizeof hdr.rec_size));
                        return FALSE;
index b959cbaf02ae091549a8368598ab15971149e175..44a520b52fced456e4f84e8e1449b12dacaf3861 100644 (file)
@@ -247,7 +247,7 @@ int airopeek9_open(wtap *wth, int *err, gchar **err_info)
     if (ret == -1)
        return -1;
     if (ret == 0) {
-       *err = WTAP_ERR_UNSUPPORTED;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: <MediaType> tag not found");
        return -1;
     }
@@ -257,7 +257,7 @@ int airopeek9_open(wtap *wth, int *err, gchar **err_info)
     if (ret == -1)
        return -1;
     if (ret == 0) {
-       *err = WTAP_ERR_UNSUPPORTED;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: <MediaType> value not found");
        return -1;
     }
@@ -266,7 +266,7 @@ int airopeek9_open(wtap *wth, int *err, gchar **err_info)
     if (ret == -1)
        return -1;
     if (ret == 0) {
-       *err = WTAP_ERR_UNSUPPORTED;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: <MediaSubType> tag not found");
        return -1;
     }
@@ -274,7 +274,7 @@ int airopeek9_open(wtap *wth, int *err, gchar **err_info)
     if (ret == -1)
        return -1;
     if (ret == 0) {
-       *err = WTAP_ERR_UNSUPPORTED;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: <MediaSubType> value not found");
        return -1;
     }
@@ -386,7 +386,7 @@ airopeekv9_process_header(FILE_T fh, hdr_info_t *hdr_info, int *err,
 
        case TAG_AIROPEEK_V9_LENGTH:
            if (saw_length) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("airopeekv9: record has two length fields");
                return 0;
            }
@@ -396,7 +396,7 @@ airopeekv9_process_header(FILE_T fh, hdr_info_t *hdr_info, int *err,
     
        case TAG_AIROPEEK_V9_TIMESTAMP_LOWER:
            if (saw_timestamp_lower) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("airopeekv9: record has two timestamp-lower fields");
                return 0;
            }
@@ -406,7 +406,7 @@ airopeekv9_process_header(FILE_T fh, hdr_info_t *hdr_info, int *err,
 
        case TAG_AIROPEEK_V9_TIMESTAMP_UPPER:
            if (saw_timestamp_upper) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("airopeekv9: record has two timestamp-upper fields");
                return 0;
            }
@@ -456,17 +456,17 @@ airopeekv9_process_header(FILE_T fh, hdr_info_t *hdr_info, int *err,
     } while (tag != TAG_AIROPEEK_V9_SLICE_LENGTH);     /* last tag */
 
     if (!saw_length) {
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: record has no length field");
        return 0;
     }
     if (!saw_timestamp_lower) {
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: record has no timestamp-lower field");
        return 0;
     }
     if (!saw_timestamp_upper) {
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup("airopeekv9: record has no timestamp-upper field");
        return 0;
     }
@@ -511,7 +511,7 @@ static gboolean airopeekv9_read(wtap *wth, int *err, gchar **err_info,
         * Probably a corrupt capture file; don't blow up trying
         * to allocate space for an immensely-large packet.
         */
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup_printf("airopeek9: File has %u-byte packet, bigger than maximum of %u",
            hdr_info.sliceLength, WTAP_MAX_PACKET_SIZE);
        return FALSE;
index dd8e750dd87d2ea5855c8034d1a5a527b155bb80..612a202b097faf0322a818b10cd4b39dba1bc895 100644 (file)
@@ -289,7 +289,7 @@ static gboolean ascend_read(wtap *wth, int *err, gchar **err_info,
       return FALSE;
   if (parse_ascend(wth->fh, buf, &wth->pseudo_header.ascend, &header,
       &(ascend->next_packet_seek_start)) != PARSED_RECORD) {
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error");
     return FALSE;
   }
@@ -337,7 +337,7 @@ static gboolean ascend_seek_read(wtap *wth, gint64 seek_off,
     return FALSE;
   if (parse_ascend(wth->random_fh, pd, &pseudo_head->ascend, NULL,
       &(ascend->next_packet_seek_start)) != PARSED_RECORD) {
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup((ascend_parse_error != NULL) ? ascend_parse_error : "parse error");
     return FALSE;
   }
index fba02f240f9cd592c4115a52b6f18fdd0682907c..e426246d0a8af9d28051f012d1a559038cb2b72e 100644 (file)
@@ -65,7 +65,7 @@ static gboolean ber_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off
      * Probably a corrupt capture file; don't blow up trying
      * to allocate space for an immensely-large packet.
      */
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup_printf("ber: File has %" G_GINT64_MODIFIER "d-byte packet, bigger than maximum of %u",
                                file_size, WTAP_MAX_PACKET_SIZE);
     return FALSE;
index 374ea83db507ca5811e6320d131c2d706806f5c4..8863f8967fb63e043efb701ee850b9d1a246a0bc 100644 (file)
@@ -190,7 +190,7 @@ static gboolean btsnoop_read(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("btsnoop: File has %u-byte packet, bigger than maximum of %u",
                    packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
index befa2399bfba8e2d1d77beac1ac28ad93da7dfb2..31aa385646e8f52d4435f6c169133da3bb1b00e7 100644 (file)
@@ -184,7 +184,7 @@ commview_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                break;
 
        default :
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("commview: unsupported encap: %u",
                                            cv_hdr.flags & FLAGS_MEDIUM);
                return FALSE;
@@ -240,7 +240,7 @@ commview_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
        }
 
        if(length != cv_hdr.data_len) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("commview: record length %u doesn't match requested length %d", cv_hdr.data_len, length);
                return FALSE;
        }
index c8f695241d95f33ada4ef237e91ae6ac3ee223ad..390070024ba324069cb97fc8ca565e4dcf668359 100644 (file)
@@ -392,7 +392,7 @@ parse_cosine_rec_hdr(wtap *wth, const char *line,
                                   &code1, &code2);
 
                if (num_items_scanned != 17) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("cosine: purported control blade line doesn't have code values");
                        return -1;
                }
@@ -405,7 +405,7 @@ parse_cosine_rec_hdr(wtap *wth, const char *line,
                                   &code1, &code2);
 
                if (num_items_scanned != 10) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("cosine: header line is neither control blade nor PE output");
                        return -1;
                }
@@ -486,7 +486,7 @@ parse_cosine_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err,
                        break;
                }
                if ((n = parse_single_hex_dump_line(line, buf, i*16)) == -1) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("cosine: hex dump line doesn't have 16 numbers");
                        return -1;
                }
index 2b5226e4027d8c71f2423516c994d085e966c15f..093d8eb4b504ee95b9600f6f0f6d1bd59cf4962d 100644 (file)
@@ -230,7 +230,7 @@ csids_seek_read (wtap *wth,
   hdr.caplen = pntohs(&hdr.caplen);
 
   if( len != hdr.caplen ) {
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup_printf("csids: record length %u doesn't match requested length %d",
                                  hdr.caplen, len);
     return FALSE;
index 113ed4a78fe208dc19e111dfef2a32aff4806091..d9094c4452ddd4add676af53df1b9b2f4b0c7695 100644 (file)
@@ -155,14 +155,14 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
        /* parse one line of capture data */
        if (sscanf(readLine, "%*s %18" G_GINT64_MODIFIER "u.%9d %9u %" READDATA_MAX_FIELD_SIZE "s",
            &seconds, &wth->phdr.ts.nsecs, &wth->phdr.len, readData) != 4) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("daintree_sna: invalid read record");
                return FALSE;
        }
 
        /* Daintree doesn't store the FCS, but pads end of packet with 0xffff, which we toss */
        if (wth->phdr.len <= FCS_LENGTH) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("daintree_sna: packet length <= %u bytes, no frame data present",
                    FCS_LENGTH);
                return FALSE;
@@ -181,13 +181,13 @@ daintree_sna_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                        buffer_assure_space(wth->frame_buffer, wth->phdr.caplen);
                        memcpy(buffer_start_ptr(wth->frame_buffer), readData, wth->phdr.caplen);
                } else {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("daintree_sna: capture length (%u) > packet length (%u)",
                                wth->phdr.caplen, wth->phdr.len);
                        return FALSE;
                }
        } else {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("daintree_sna: invalid packet data");
                return FALSE;
        }
@@ -218,14 +218,14 @@ daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
 
        /* ignore all but packet data, since the sequential read pass stored everything else */
        if (sscanf(seekLine, "%*s %*u.%*u %*u %" SEEKDATA_MAX_FIELD_SIZE "s", seekData) != 1) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("daintree_sna: corrupted seek record");
                return FALSE;
        }
 
        /* convert packet data from ASCII hex string to guchar */
        if ((pkt_len = daintree_sna_hex_char(seekData, err)) <= FCS_LENGTH) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("daintree_sna: corrupted packet data");
                return FALSE;
        }
@@ -236,7 +236,7 @@ daintree_sna_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
                /* move to frame buffer for dissection */
                memcpy(pd, seekData, pkt_len);
        } else {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("daintree-sna: corrupted frame");
                return FALSE;
        } 
index 0d9f753f3547711c8a359616209e7254eaf2a93c..366a118aba9fe7be67986006894161d9f16da84f 100644 (file)
@@ -260,7 +260,7 @@ dbs_etherwatch_seek_read (wtap *wth, gint64 seek_off,
 
        if (pkt_len != len) {
                if (pkt_len != -1) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("dbs_etherwatch: packet length %d doesn't match requested length %d",
                            pkt_len, len);
                }
@@ -349,14 +349,14 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
        /* Get the destination address */
        p = strstr(line, DEST_MAC_PREFIX);
        if(!p) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("dbs_etherwatch: destination address not found");
                return -1;
        }
        p += strlen(DEST_MAC_PREFIX);
        if(parse_hex_dump(p, &buf[eth_hdr_len], HEX_HDR_SPR, HEX_HDR_END)
                                != MAC_ADDR_LENGTH) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("dbs_etherwatch: destination address not valid");
                return -1;
        }
@@ -374,7 +374,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
        }
        if(parse_hex_dump(p, &buf[eth_hdr_len], HEX_HDR_SPR,
                HEX_HDR_END) != MAC_ADDR_LENGTH) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("dbs_etherwatch: source address not valid");
                return -1;
        }
@@ -391,7 +391,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
 
        /* Check the lines is as least as long as the length position */
        if(strlen(line) < LENGTH_POS) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("dbs_etherwatch: line too short");
                return -1;
        }
@@ -404,7 +404,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                                &tm.tm_sec, &csec);
 
        if (num_items_scanned != 8) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("dbs_etherwatch: header line not valid");
                return -1;
        }
@@ -416,7 +416,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                /* Get the Protocol */
                if(parse_hex_dump(&line[PROTOCOL_POS], &buf[eth_hdr_len], HEX_HDR_SPR,
                                        HEX_HDR_END) != PROTOCOL_LENGTH) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("dbs_etherwatch: Ethernet II protocol value not valid");
                        return -1;
                }
@@ -432,7 +432,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                /* Get the DSAP + SSAP */
                if(parse_hex_dump(&line[SAP_POS], &buf[eth_hdr_len], HEX_HDR_SPR,
                                        HEX_HDR_END) != SAP_LENGTH) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("dbs_etherwatch: 802.2 DSAP+SSAP value not valid");
                        return -1;
                }
@@ -440,7 +440,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                /* Get the (first part of the) control field */
                if(parse_hex_dump(&line[CTL_POS], &buf[eth_hdr_len], HEX_HDR_SPR,
                                        HEX_HDR_END) != CTL_UNNUMB_LENGTH) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("dbs_etherwatch: 802.2 control field first part not valid");
                        return -1;
                }
@@ -450,7 +450,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                        if(parse_hex_dump(&line[PID_POS],
                                                &buf[eth_hdr_len + CTL_UNNUMB_LENGTH], HEX_HDR_END,
                                                HEX_HDR_SPR) != CTL_NUMB_LENGTH - CTL_UNNUMB_LENGTH) {
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup("dbs_etherwatch: 802.2 control field second part value not valid");
                                return -1;
                        }
@@ -464,7 +464,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                        /* Get the PID */
                        if(parse_hex_dump(&line[PID_POS], &buf[eth_hdr_len], HEX_HDR_SPR,
                                                HEX_PID_END) != PID_LENGTH) {
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup("dbs_etherwatch: 802.2 PID value not valid");
                                return -1;
                        }
@@ -501,13 +501,13 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
                }
                if (!(line_count = parse_single_hex_dump_line(line,
                                &buf[eth_hdr_len + count], count))) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("dbs_etherwatch: packet data value not valid");
                        return -1;
                }
                count += line_count;
                if (count > pkt_len) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("dbs_etherwatch: packet data value has too many bytes");
                        return -1;
                }
index 77611543e23ff8ebbceaaca2f33269d77e2ebbb9..12910bebacb0cc2b2b68f0ddcedab5b5e8724c05 100644 (file)
@@ -240,7 +240,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, union wtap_pseudo_header *pseudo
                        else
                        {
                                /* If not got any data return error */
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup_printf("dct3trace: record without data");
                                return FALSE;
                        }
@@ -271,7 +271,7 @@ static gboolean dct3trace_get_packet(FILE_T fh, union wtap_pseudo_header *pseudo
 
                        if( ret != 0 )
                        {
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup_printf("dct3trace: record missing mandatory attributes");
                                return FALSE;
                        }
@@ -387,7 +387,7 @@ static gboolean dct3trace_seek_read (wtap *wth, gint64 seek_off,
 
        if( len != buf_len && len != -1 )
        {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("dct3trace: requested length %d doesn't match record length %d",
                    len, buf_len);
                return FALSE;
@@ -395,7 +395,7 @@ static gboolean dct3trace_seek_read (wtap *wth, gint64 seek_off,
 
        if( buf_len > MAX_PACKET_LEN)
        {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("dct3trace: record length %d too long", buf_len);
                return FALSE;
        }
index 7b111d3d291523128a774ea7fb9315d3b01f112c..c5dc837927a172be7fa4585011343ed6a0bb228b 100644 (file)
@@ -358,7 +358,7 @@ static int erf_read_header(FILE_T fh,
      * Probably a corrupt capture file; don't blow up trying
      * to allocate space for an immensely-large packet.
      */
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u",
                                *packet_size, WTAP_MAX_PACKET_SIZE);
     return FALSE;
@@ -366,7 +366,7 @@ static int erf_read_header(FILE_T fh,
 
   if (*packet_size == 0) {
     /* Again a corrupt packet, bail out */
-   *err = WTAP_ERR_BAD_RECORD;
+   *err = WTAP_ERR_BAD_FILE;
    *err_info = g_strdup_printf("erf: File has 0 byte packet");
 
    return FALSE;
@@ -482,7 +482,7 @@ static int erf_read_header(FILE_T fh,
      * Probably a corrupt capture file; don't blow up trying
      * to allocate space for an immensely-large packet.
      */
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup_printf("erf: File has %u-byte packet, bigger than maximum of %u",
                                 *packet_size, WTAP_MAX_PACKET_SIZE);
     return FALSE;
index bf4674c896c55d5e3d3e7bdcabb6341068e2653c..e28b373f0ec17c285d4930f95ed6a0034f5cb079 100644 (file)
@@ -421,7 +421,7 @@ static gboolean etherpeek_read_v7(wtap *wth, int *err, gchar **err_info,
                        /*
                         * We don't *have* 4 bytes of packet data.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("etherpeek: packet not long enough for 802.11 radio header");
                        return FALSE;
                }
@@ -504,7 +504,7 @@ etherpeek_seek_read_v7(wtap *wth, gint64 seek_off,
                        /*
                         * We don't *have* 4 bytes of packet data.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("etherpeek: packet not long enough for 802.11 radio header");
                        return FALSE;
                }
index 8ca55bf9ee4d23a4ba97f1f78b465a31e4556e0d..c2bf571e7cd4d50134f43524f24177db25839fa5 100644 (file)
@@ -209,7 +209,7 @@ eyesdn_seek_read (wtap *wth, gint64 seek_off,
 
        if (pkt_len != len) {
                if (pkt_len != -1) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("eyesdn: requested length %d doesn't match length %d",
                            len, pkt_len);
                }
@@ -296,7 +296,7 @@ parse_eyesdn_rec_hdr(wtap *wth, FILE_T fh,
                gint64 cur_off;
 
                if(pkt_len != CELL_LEN) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf(
                            "eyesdn: ATM cell has a length != 53 (%u)",
                            pkt_len);
@@ -360,7 +360,7 @@ parse_eyesdn_rec_hdr(wtap *wth, FILE_T fh,
        }
 
        if(pkt_len > EYESDN_MAX_PACKET_LEN) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("eyesdn: File has %u-byte packet, bigger than maximum of %u",
                pkt_len, EYESDN_MAX_PACKET_LEN);
                return -1;
@@ -391,7 +391,7 @@ parse_eyesdn_packet_data(FILE_T fh, int pkt_len, guint8* buf, int *err,
                        if (*err == 0)
                                *err = WTAP_ERR_SHORT_READ;
                } else if (bytes_read == -1) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("eyesdn: No flag character seen in frame");
                } else
                        *err = WTAP_ERR_SHORT_READ;
index 104d9f918c835a3044882aa41fe42e4fd04befc2..07242fe4e1c224f41b7562826b1c8db3d94d9018 100644 (file)
@@ -62,7 +62,7 @@ static gboolean hcidump_read(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("hcidump: File has %u-byte packet, bigger than maximum of %u",
                        packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
index ac2336ce403b227e4f3ae148f03f815a8a22972c..ce6421aefc7aee0c8539d9d2f2a4369deab808c8 100644 (file)
@@ -139,7 +139,7 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
        wth->data_offset += sizeof hdr;
        i4b_byte_swap_header(wth, &hdr);
        if (hdr.length < sizeof(hdr)) {
-               *err = WTAP_ERR_BAD_RECORD;     /* record length < header! */
+               *err = WTAP_ERR_BAD_FILE;       /* record length < header! */
                *err_info = g_strdup_printf("i4btrace: record length %u < header length %lu",
                    hdr.length, (unsigned long)sizeof(hdr));
                return FALSE;
@@ -150,7 +150,7 @@ static gboolean i4btrace_read(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("i4btrace: File has %u-byte packet, bigger than maximum of %u",
                    length, WTAP_MAX_PACKET_SIZE);
                return FALSE;
index 5bd08f58b2099abc9677d093f1129721a82fe34e..cdfcdc53e986f665117dc46899e3949c0d2ba25c 100644 (file)
@@ -140,13 +140,13 @@ ipfix_read_message_header(ipfix_message_header_t *pfx_hdr, FILE_T fh, int *err,
     /* is the version number one we expect? */
     if (pfx_hdr->version != IPFIX_VERSION) {
         /* Not an ipfix file. */
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("ipfix: wrong version %d", pfx_hdr->version);
         return FALSE;
     }
 
     if (pfx_hdr->message_length < 16) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("ipfix: message length %u is too short", pfx_hdr->message_length);
         return FALSE;
     }
@@ -193,7 +193,7 @@ ipfix_open(wtap *wth, int *err, gchar **err_info)
         if (!ipfix_read_message_header(&msg_hdr, wth->fh, err, err_info)) {
             ipfix_debug3("ipfix_open: couldn't read message header #%d with err code #%d (%s)",
                          i, *err, *err_info);
-            if (*err == WTAP_ERR_BAD_RECORD) {
+            if (*err == WTAP_ERR_BAD_FILE) {
                 *err = 0;            /* not actually an error in this case */
                 g_free(*err_info);
                 *err_info = NULL;
@@ -313,7 +313,7 @@ ipfix_seek_read(wtap *wth, gint64 seek_off,
     }
 
     if(length != (int)msg_hdr.message_length) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("ipfix: record length %u doesn't match requested length %d",
                                     msg_hdr.message_length, length);
         ipfix_debug1("ipfix_seek_read: %s", *err_info);
index 91fd750b5c8ed59e3fdb52bb0928049061d551c0..b9a382c8100877f0d2f3f7d5099cd4eedea867a3 100644 (file)
@@ -158,7 +158,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
                 * Uh-oh, the record isn't big enough to even have a
                 * packet meta-data header.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header",
                    packet_size);
                return FALSE;
@@ -179,7 +179,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
                         * Uh-oh, the record isn't big enough to even have
                         * the padding.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header",
                            packet_size + IPTRACE_1_0_PDATA_SIZE);
                        return FALSE;
@@ -199,7 +199,7 @@ static gboolean iptrace_read_1_0(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u",
                    packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
@@ -372,7 +372,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
                 * Uh-oh, the record isn't big enough to even have a
                 * packet meta-data header.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header",
                    packet_size);
                return FALSE;
@@ -393,7 +393,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
                         * Uh-oh, the record isn't big enough to even have
                         * the padding.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("iptrace: file has a %u-byte record, too small to have even a packet meta-data header",
                            packet_size + IPTRACE_2_0_PDATA_SIZE);
                        return FALSE;
@@ -413,7 +413,7 @@ static gboolean iptrace_read_2_0(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("iptrace: File has %u-byte packet, bigger than maximum of %u",
                    packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
index 103bf70ae228d5185e9e444d4769970f8f055e16..526840e812c4a1da6861e8dc0ebdc1e5215e181b 100644 (file)
@@ -534,7 +534,7 @@ iseries_seek_read (wtap * wth, gint64 seek_off,
     {
       if (pkt_len != -1)
        {
-         *err = WTAP_ERR_BAD_RECORD;
+         *err = WTAP_ERR_BAD_FILE;
          *err_info =
            g_strdup_printf
            ("iseries: requested length %d doesn't match record length %d",
@@ -612,7 +612,7 @@ iseries_parse_packet (wtap * wth, FILE_T fh,
    */
   if (!isValid)
     {
-      *err = WTAP_ERR_BAD_RECORD;
+      *err = WTAP_ERR_BAD_FILE;
       *err_info = g_strdup ("iseries: packet header isn't valid");
       return -1;
     }
@@ -902,13 +902,13 @@ iseries_parse_packet (wtap * wth, FILE_T fh,
        {
                if (!IPread)
                {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup ("iseries: IP header isn't valid");
                        return -1;
                }
                if (!TCPread)
                {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup ("iseries: TCP header isn't valid");
                        return -1;
                }
index d41ccac06e423879162e900330b5bd3e02e2e7b5..0ff3d68f16214d7d6248c3e5debf803c2c4d5cca 100644 (file)
@@ -337,7 +337,7 @@ static gint get_record(guint8** bufferp, FILE_T fh, gint64 file_offset,
     /* XXX - Is WTAP_MAX_PACKET_SIZE */
     if (left < 4 || left > WTAP_MAX_PACKET_SIZE) {
         K12_DBG(1,("get_record: Invalid GET length=%u",left));
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("get_record: Invalid GET length=%u",left);
         return -1;
     }
index fae1d6235029c856245ffa5bf2866c8bbfe3ac9f..687ef92849726e8607104895b69aef02867c4aaf 100644 (file)
@@ -242,7 +242,7 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset)
                        *err = 0;
                        *err_info = NULL;
                } else {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = error_str;
                }
                return FALSE;
@@ -278,7 +278,7 @@ k12text_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_h
        yylex();
 
        if (ok_frame == FALSE) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                if (at_eof) {
                        /* What happened ? The desired frame was previously read without a problem */
                        *err_info = g_strdup("Unexpected EOF (program error ?)");
@@ -291,7 +291,7 @@ k12text_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header *pseudo_h
        /* verify frame length parsed this time against original frame length */
        if (ii != (guint)length) {
                /* What happened ? This now seems to have a different length than originally */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("Incorrect frame length (program error ?)");
                return FALSE;
        }
index 2c049297f00aad91bd0447518c49f580bec27097..5fbf8714c2177d76b3d24b8472327b07c2508af9 100644 (file)
@@ -461,7 +461,7 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
         * the middle of reading packets.  If any other record type exists
         * after a Trace Packet Data Record, mark it as an error. */
        if (record_type != RT_PacketData) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("lanalyzer: record type %u seen after trace summary record",
                    record_type);
                return FALSE;
@@ -472,7 +472,7 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
                         * Uh-oh, the record isn't big enough to even have a
                         * descriptor.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("lanalyzer: file has a %u-byte record, too small to have even a packet descriptor",
                            record_length);
                        return FALSE;
@@ -517,7 +517,7 @@ static gboolean lanalyzer_read(wtap *wth, int *err, gchar **err_info,
                /*
                 * Yes - treat this as an error.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("lanalyzer: Record length is less than packet size");
                return FALSE;
        }
index c8e5cb7d7409775c5d2d97f6d094437b8600a078..c5d1b31738bf0749fa45a58775eb281c16d1b714 100644 (file)
@@ -528,7 +528,7 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err)
                        return THIS_FORMAT;
                }
 
-               if (*err == WTAP_ERR_BAD_RECORD) {
+               if (*err == WTAP_ERR_BAD_FILE) {
                        /*
                         * The first record is bogus, so this is probably
                         * a corrupt file.  Assume the file is in this
@@ -567,7 +567,7 @@ static libpcap_try_t libpcap_try(wtap *wth, int *err)
                        return THIS_FORMAT;
                }
 
-               if (*err == WTAP_ERR_BAD_RECORD) {
+               if (*err == WTAP_ERR_BAD_FILE) {
                        /*
                         * The second record is bogus; maybe it's a
                         * Capture File From Hell, and what looks like
@@ -762,7 +762,7 @@ static int libpcap_read_header(wtap *wth, int *err, gchar **err_info,
                 * this is can tell when it's not the type we're guessing
                 * it is.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                if (err_info != NULL) {
                        *err_info = g_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u",
                            hdr->hdr.incl_len, WTAP_MAX_PACKET_SIZE);
@@ -779,7 +779,7 @@ static int libpcap_read_header(wtap *wth, int *err, gchar **err_info,
                 * this is can tell when it's not the type we're guessing
                 * it is.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                if (err_info != NULL) {
                        *err_info = g_strdup_printf("pcap: File has %u-byte packet, bigger than maximum of %u",
                            hdr->hdr.orig_len, WTAP_MAX_PACKET_SIZE);
@@ -953,7 +953,7 @@ static gboolean libpcap_dump(wtap_dumper *wdh,
        rec_hdr.hdr.orig_len = phdr->len + phdrsize;
 
        if (rec_hdr.hdr.incl_len > WTAP_MAX_PACKET_SIZE || rec_hdr.hdr.orig_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                return FALSE;
        }
 
index 674866fa176ebaa7bde39765fb3a89193b1c04b1..ea57240f9022910a1a3ef2ed19e18deb06609a6f 100644 (file)
@@ -325,14 +325,14 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
        frame_table_length = pletohl(&hdr.frametablelength);
        frame_table_size = frame_table_length / (guint32)sizeof (guint32);
        if ((frame_table_size * sizeof (guint32)) != frame_table_length) {
-               *err = WTAP_ERR_UNSUPPORTED;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("netmon: frame table length is %u, which is not a multiple of the size of an entry",
                    frame_table_length);
                g_free(netmon);
                return -1;
        }
        if (frame_table_size == 0) {
-               *err = WTAP_ERR_UNSUPPORTED;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("netmon: frame table length is %u, which means it's less than one entry in size",
                    frame_table_length);
                g_free(netmon);
@@ -352,7 +352,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
         * itself, and probably won't exhaust the backing store.
         */
        if (frame_table_size > 512*1024*1024) {
-               *err = WTAP_ERR_UNSUPPORTED;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("netmon: frame table length is %u, which is larger than we support",
                    frame_table_length);
                g_free(netmon);
@@ -559,7 +559,7 @@ again:
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("netmon: File has %u-byte packet, bigger than maximum of %u",
                    packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
@@ -582,7 +582,7 @@ again:
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("netmon: ATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
                            packet_size);
                        return FALSE;
@@ -754,7 +754,7 @@ netmon_seek_read(wtap *wth, gint64 seek_off,
                        /*
                         * This should not happen.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("netmon: saw metadata in netmon_seek_read");
                        return FALSE;
                }
index dadc4a667931a532201f0a6cb0dc27b11230e41d..e3c29e70f390ccb44386a8da934d1306d35a2aa8 100644 (file)
@@ -360,7 +360,7 @@ parse_netscreen_rec_hdr(wtap *wth, const char *line, char *cap_int,
 
        if (sscanf(line, "%9d.%9d: %15[a-z0-9/:.](%1[io]) len=%9d:%12s->%12s/",
                   &sec, &dsec, cap_int, direction, &pkt_len, cap_src, cap_dst) < 5) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("netscreen: Can't parse packet-header");
                return -1;
        }
@@ -422,7 +422,7 @@ parse_netscreen_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err, gchar **
                                        continue;
                                }
                        } else {
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup("netscreen: cannot parse hex-data");
                                return -1;
                        }
@@ -432,7 +432,7 @@ parse_netscreen_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err, gchar **
                 * then there must be an error in the file
                 */
                if(n == -1) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("netscreen: cannot parse hex-data");
                        return -1;
                }
@@ -444,7 +444,7 @@ parse_netscreen_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err, gchar **
                 * header, then then there must be an error in the file
                 */
                if(offset > pkt_len) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                         *err_info = g_strdup("netscreen: to much hex-data");
                         return -1;
                }
index e265b45da95f79bd3a8ebe84c6d7234ddbc0247c..735fe9edf7867f5c50cb318725d8e1714cb8d5b8 100644 (file)
@@ -323,7 +323,7 @@ static gboolean nettl_read(wtap *wth, int *err, gchar **err_info,
         * Probably a corrupt capture file; don't blow up trying
         * to allocate space for an immensely-large packet.
         */
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup_printf("nettl: File has %u-byte packet, bigger than maximum of %u",
            wth->phdr.caplen, WTAP_MAX_PACKET_SIZE);
        return FALSE;
@@ -417,7 +417,7 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
     offset += 2;
     hdr_len = g_ntohs(rec_hdr.hdr_len);
     if (hdr_len < NETTL_REC_HDR_LEN) {
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup_printf("nettl: record header length %u too short",
            hdr_len);
        return -1;
@@ -635,14 +635,14 @@ nettl_read_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
     }
 
     if (length < padlen) {
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup_printf("nettl: packet length %u in record header too short, less than %u",
            length, padlen);
        return -1;
     }
     phdr->len = length - padlen;
     if (caplen < padlen) {
-       *err = WTAP_ERR_BAD_RECORD;
+       *err = WTAP_ERR_BAD_FILE;
        *err_info = g_strdup_printf("nettl: captured length %u in record header too short, less than %u",
            caplen, padlen);
        return -1;
index d706e222f4439baea9204e6d0ab9285452592329..97ae73ef45478ed11d8277c67cfd0efdc61937f4 100644 (file)
@@ -174,7 +174,7 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info)
         TLV_HEADER_FROM_LE_IN_PLACE(tlvh);
 
         if (tlvh.length < sizeof tlvh) {
-            *err = WTAP_ERR_BAD_RECORD;
+            *err = WTAP_ERR_BAD_FILE;
             *err_info = g_strdup_printf("Observer: bad record (TLV length %u < %lu)",
                 tlvh.length, (unsigned long)sizeof tlvh);
             return -1;
@@ -205,7 +205,7 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info)
 
     /* get to the first packet */
     if (header_offset < offset) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("Observer: bad record (offset to first packet %d < %d)",
             header_offset, offset);
         return FALSE;
@@ -296,7 +296,7 @@ static gboolean observer_read(wtap *wth, int *err, gchar **err_info,
 
     /* neglect frame markers for wiretap */
     if (packet_header.network_size < 4) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("Observer: bad record: Packet length %u < 4",
             packet_header.network_size);
         return FALSE;
@@ -445,7 +445,7 @@ read_packet_header(FILE_T fh, packet_entry_header *packet_header, int *err,
             return 0;    /* EOF */
         }
 
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("Observer: bad record: Invalid magic number 0x%08x",
             packet_header->packet_magic);
         return -1;
@@ -465,7 +465,7 @@ read_packet_header(FILE_T fh, packet_entry_header *packet_header, int *err,
         TLV_HEADER_FROM_LE_IN_PLACE(tlvh);
 
         if (tlvh.length < sizeof tlvh) {
-            *err = WTAP_ERR_BAD_RECORD;
+            *err = WTAP_ERR_BAD_FILE;
             *err_info = g_strdup_printf("Observer: bad record (TLV length %u < %lu)",
                 tlvh.length, (unsigned long)sizeof tlvh);
             return -1;
@@ -492,7 +492,7 @@ read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_from_packet_
 
     /* validate offsets */
     if (offset_to_frame < current_offset_from_packet_header) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("Observer: bad record (offset to packet data %d < %d)",
             offset_to_frame, current_offset_from_packet_header);
         return -1;
@@ -522,7 +522,7 @@ skip_to_next_packet(wtap *wth, int offset_to_next_packet, int current_offset_fro
 
     /* validate offsets */
     if (offset_to_next_packet < current_offset_from_packet_header) {
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("Observer: bad record (offset to next packet %d < %d)",
             offset_to_next_packet, current_offset_from_packet_header);
         return FALSE;
index 73625b90bc9573e628f0c12a7267f329f850e942..4c0291fbd2e761f8e099dd1723ec472462058969 100644 (file)
@@ -598,7 +598,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
        type = pletohs(record_type);
 
        if (type != REC_VERS) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("ngsniffer: Sniffer file doesn't start with a version record");
                return -1;
        }
@@ -1074,7 +1074,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                                 * We shouldn't get a frame2 record in
                                 * an ATM capture.
                                 */
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup("ngsniffer: REC_FRAME2 record in an ATM Sniffer file");
                                return FALSE;
                        }
@@ -1105,7 +1105,7 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                                 * We shouldn't get a frame2 record in
                                 * a non-ATM capture.
                                 */
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup("ngsniffer: REC_FRAME4 record in a non-ATM Sniffer file");
                                return FALSE;
                        }
@@ -1193,7 +1193,7 @@ found:
                /*
                 * Yes - treat this as an error.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("ngsniffer: Record length is less than packet size");
                return FALSE;
        }
index afe918f9a9559f607e67d8f950d3c024fe6a49e2..7e03b79a52921352abc743b64c6bcea6160b5816 100644 (file)
@@ -102,7 +102,7 @@ packetlogger_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                return FALSE;
 
        if (pl_hdr.len < 8) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("packetlogger: record length %u is too small", pl_hdr.len);
                return FALSE;
        }
@@ -111,7 +111,7 @@ packetlogger_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("packetlogger: File has %u-byte packet, bigger than maximum of %u",
                    pl_hdr.len - 8, WTAP_MAX_PACKET_SIZE);
                return FALSE;
@@ -159,7 +159,7 @@ packetlogger_seek_read(wtap *wth, gint64 seek_off, union wtap_pseudo_header
        }
 
        if(length != (int)pl_hdr.len - 8) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("packetlogger: record length %u doesn't match requested length %d", pl_hdr.len, length);
                return FALSE;
        }
index baf6ed007e9a79958282a1412b192a136a2081d4..25a2be444c1fab04d0f9629d14c70a5122b0f8f6 100644 (file)
@@ -857,7 +857,7 @@ pcap_read_irda_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
        }
 
        if (pntohs(&irda_phdr[IRDA_SLL_PROTOCOL_OFFSET]) != 0x0017) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                if (err_info != NULL)
                        *err_info = g_strdup("libpcap: IrDA capture has a packet with an invalid sll_protocol field");
                return FALSE;
@@ -907,7 +907,7 @@ pcap_read_lapd_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
        }
 
        if (pntohs(&lapd_phdr[LAPD_SLL_PROTOCOL_OFFSET]) != ETH_P_LAPD) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                if (err_info != NULL)
                        *err_info = g_strdup("libpcap: LAPD capture has a packet with an invalid sll_protocol field");
                return FALSE;
@@ -1399,7 +1399,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                                 * Uh-oh, the packet isn't big enough to even
                                 * have a pseudo-header.
                                 */
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup_printf("pcap: Nokia IPSO ATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
                                    packet_size);
                                return -1;
@@ -1418,7 +1418,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                                 * Uh-oh, the packet isn't big enough to even
                                 * have a pseudo-header.
                                 */
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup_printf("pcap: SunATM file has a %u-byte packet, too small to have even an ATM pseudo-header",
                                    packet_size);
                                return -1;
@@ -1459,7 +1459,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: IrDA file has a %u-byte packet, too small to have even an IrDA pseudo-header",
                            packet_size);
                        return -1;
@@ -1477,7 +1477,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: MTP2 file has a %u-byte packet, too small to have even an MTP2 pseudo-header",
                            packet_size);
                        return -1;
@@ -1495,7 +1495,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: LAPD file has a %u-byte packet, too small to have even a LAPD pseudo-header",
                            packet_size);
                        return -1;
@@ -1513,7 +1513,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: SITA file has a %u-byte packet, too small to have even a SITA pseudo-header",
                            packet_size);
                        return -1;
@@ -1537,7 +1537,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: libpcap bluetooth file has a %u-byte packet, too small to have even a pseudo-header",
                            packet_size);
                        return -1;
@@ -1556,7 +1556,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: libpcap ppp file has a %u-byte packet, too small to have even a pseudo-header",
                            packet_size);
                        return -1;
@@ -1575,7 +1575,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: ERF file has a %u-byte packet, too small to have even an ERF pseudo-header",
                            packet_size);
                        return -1;
@@ -1609,7 +1609,7 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("pcap: I2C file has a %u-byte packet, too small to have even a I2C pseudo-header",
                            packet_size);
                        return -1;
index bf233a15f87bd60bd197bf143ccb4dd9970d1163..f5aff4066fbc4091fc49d33275ed806e49ed22e5 100644 (file)
@@ -461,7 +461,7 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block,
                }
 
                /* A bad block */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_section_header_block: unknown byte-order magic number 0x%08x", shb.magic);
                return 0;
        }
@@ -555,7 +555,7 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block,
        if (pn->interface_data != NULL) {
                g_array_free(pn->interface_data, TRUE);
                pn->interface_data = NULL;
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng: multiple section header blocks not supported.");
                return 0;
        }
@@ -837,13 +837,13 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
        }
 
        if (wblock->data.packet.cap_len > wblock->data.packet.packet_len) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_packet_block: cap_len %u is larger than packet_len %u.",
                    wblock->data.packet.cap_len, wblock->data.packet.packet_len);
                return 0;
        }
        if (wblock->data.packet.cap_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_packet_block: cap_len %u is larger than WTAP_MAX_PACKET_SIZE %u.",
                    wblock->data.packet.cap_len, WTAP_MAX_PACKET_SIZE);
                return 0;
@@ -853,7 +853,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
                      wblock->data.packet.cap_len,
                      wblock->data.packet.interface_id);
        if (wblock->data.packet.packet_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_packet_block: packet_len %u is larger than WTAP_MAX_PACKET_SIZE %u.",
                    wblock->data.packet.packet_len, WTAP_MAX_PACKET_SIZE);
                return 0;
@@ -1022,7 +1022,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
                                             - (guint32)sizeof(bh->block_total_length);
 
        if (wblock->data.simple_packet.cap_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_simple_packet_block: cap_len %u is larger than WTAP_MAX_PACKET_SIZE %u.",
                    wblock->data.simple_packet.cap_len, WTAP_MAX_PACKET_SIZE);
                return 0;
@@ -1030,7 +1030,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
        pcapng_debug1("pcapng_read_simple_packet_block: packet data: packet_len %u",
                       wblock->data.simple_packet.packet_len);
        if (wblock->data.simple_packet.packet_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_simple_packet_block: packet_len %u is larger than WTAP_MAX_PACKET_SIZE %u.",
                    wblock->data.simple_packet.packet_len, WTAP_MAX_PACKET_SIZE);
                return 0;
@@ -1432,7 +1432,7 @@ pcapng_read_block(FILE_T fh, gboolean first_block, pcapng_t *pn, wtapng_block_t
                block_total_length = BSWAP32(block_total_length);
 
        if (!(block_total_length == bh.block_total_length)) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng_read_block: total block lengths (first %u and second %u) don't match",
                              bh.block_total_length, block_total_length);
                return -1;
@@ -1572,7 +1572,7 @@ pcapng_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
                wth->phdr.ts.nsecs = (int)(((ts % time_units_per_second) * 1000000000) / time_units_per_second);
        } else {
                wth->phdr.pkt_encap = WTAP_ENCAP_UNKNOWN;
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("pcapng: interface index %u is not less than interface count %u.",
                    wblock.data.packet.interface_id, pcapng->number_of_interfaces);
                wth->data_offset = *data_offset + bytes_read;
index c483b8a1d8db22cb7c5f9461b34a9303f3c6cdd9..46465bca7add652e78727114320e5d1a1e422049 100644 (file)
@@ -680,7 +680,7 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd,
 
                        default:
                                /* XXX - bad file */
-                               *err = WTAP_ERR_BAD_RECORD;
+                               *err = WTAP_ERR_BAD_FILE;
                                *err_info = g_strdup_printf("pppdump: bad ID byte 0x%02x", id);
                                return FALSE;
                }
@@ -724,7 +724,7 @@ pppdump_seek_read(wtap *wth,
 
        pid = g_ptr_array_index(state->pids, seek_off);
        if (!pid) {
-               *err = WTAP_ERR_BAD_RECORD;     /* XXX - better error? */
+               *err = WTAP_ERR_BAD_FILE;       /* XXX - better error? */
                *err_info = g_strdup("pppdump: PID not found for record");
                return FALSE;
        }
@@ -755,7 +755,7 @@ pppdump_seek_read(wtap *wth,
        } while (direction != pid->dir);
 
        if (len != num_bytes) {
-               *err = WTAP_ERR_BAD_RECORD;     /* XXX - better error? */
+               *err = WTAP_ERR_BAD_FILE;       /* XXX - better error? */
                *err_info = g_strdup_printf("pppdump: requested length %d doesn't match record length %d",
                    len, num_bytes);
                return FALSE;
index ebda14ce94ca10592a85fa0ac5eaf7e985a6d8d4..9df367a41325791d738b63b06161d155bc25241c 100644 (file)
@@ -489,7 +489,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("snoop: File has %u-byte original length, bigger than maximum of %u",
                    orig_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
@@ -499,7 +499,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
                 * Probably a corrupt capture file; don't blow up trying
                 * to allocate space for an immensely-large packet.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("snoop: File has %u-byte packet, bigger than maximum of %u",
                    packet_size, WTAP_MAX_PACKET_SIZE);
                return FALSE;
@@ -508,7 +508,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
                /*
                 * Probably a corrupt capture file.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("snoop: File has %u-byte packet, bigger than record size %u",
                    packet_size, rec_size);
                return FALSE;
@@ -530,7 +530,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("snoop: atmsnoop file has a %u-byte packet, too small to have even an ATM pseudo-header",
                            packet_size);
                        return FALSE;
@@ -566,7 +566,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
                         * Uh-oh, the packet isn't big enough to even
                         * have a pseudo-header.
                         */
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("snoop: Shomiti wireless file has a %u-byte packet, too small to have even a wireless pseudo-header",
                            packet_size);
                        return FALSE;
@@ -617,7 +617,7 @@ static gboolean snoop_read(wtap *wth, int *err, gchar **err_info,
                /*
                 * What, *negative* padding?  Bogus.
                 */
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("snoop: File has %u-byte record with packet size of %u",
                    rec_size, packet_size);
                return FALSE;
@@ -823,7 +823,7 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
         * 4 bytes of length plus 8 bytes of information?
         */
        if (whdr.pad[3] < 8) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("snoop: Header length in Surveyor record is %u, less than minimum of 8",
                    whdr.pad[3]);
                return FALSE;
index 1fca6878051680d3e5abc3abf04c17da76703e22..d43ffc92701457eea9a82ba064b816bde6cbe129 100644 (file)
@@ -58,7 +58,7 @@ static gboolean tnef_read(wtap *wth, int *err, gchar **err_info, gint64 *data_of
      * Probably a corrupt capture file; don't blow up trying
      * to allocate space for an immensely-large packet.
      */
-    *err = WTAP_ERR_BAD_RECORD;
+    *err = WTAP_ERR_BAD_FILE;
     *err_info = g_strdup_printf("tnef: File has %" G_GINT64_MODIFIER "d-byte packet, bigger than maximum of %u",
                                file_size, WTAP_MAX_PACKET_SIZE);
     return FALSE;
index 2072ccddc298cb5812c1fa43dad7f4f980f550cd..921bd988aa9bc2282a46200bd87e6670a5c7de45 100644 (file)
@@ -280,7 +280,7 @@ toshiba_seek_read (wtap *wth, gint64 seek_off,
 
        if (pkt_len != len) {
                if (pkt_len != -1) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup_printf("toshiba: requested length %d doesn't match record length %d",
                            len, pkt_len);
                }
@@ -319,7 +319,7 @@ parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
                        &pktnum, &hr, &min, &sec, &csec, channel, direction);
 
        if (num_items_scanned != 7) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("toshiba: record header isn't valid");
                return -1;
        }
@@ -349,7 +349,7 @@ parse_toshiba_rec_hdr(wtap *wth, FILE_T fh,
 
        num_items_scanned = sscanf(line+64, "LEN=%9d", &pkt_len);
        if (num_items_scanned != 1) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup("toshiba: OFFSET line doesn't have valid LEN item");
                return -1;
        }
@@ -407,7 +407,7 @@ parse_toshiba_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err,
                        return FALSE;
                }
                if (!parse_single_hex_dump_line(line, buf, i * 16)) {
-                       *err = WTAP_ERR_BAD_RECORD;
+                       *err = WTAP_ERR_BAD_FILE;
                        *err_info = g_strdup("toshiba: hex dump not valid");
                        return FALSE;
                }
index e6998ce3d477d44882fa1c147abe58f86f5e0ed4..e516f14e64de700434f532f972ab861d47e7d220 100644 (file)
@@ -359,7 +359,7 @@ static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
     {
         /* Probably a corrupt capture file; don't blow up trying
           to allocate space for an immensely-large packet. */
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("visual: File has %u-byte packet, bigger than maximum of %u",
             packet_size, WTAP_MAX_PACKET_SIZE);
         return FALSE;
@@ -423,7 +423,7 @@ static gboolean visual_read(wtap *wth, int *err, gchar **err_info,
     if (wth->phdr.len > WTAP_MAX_PACKET_SIZE) {
     /* Check if wth->phdr.len is sane, small values of wth.phdr.len before
        the case loop above can cause integer underflows */ 
-        *err = WTAP_ERR_BAD_RECORD;
+        *err = WTAP_ERR_BAD_FILE;
         *err_info = g_strdup_printf("visual: File has %u-byte original packet, bigger than maximum of %u",
                     wth->phdr.len, WTAP_MAX_PACKET_SIZE);
         return FALSE;
index 89b5c833e73bb99420634386425591cbee84db9a..109b20964dcaaa1cd364de6e8e0adadc3736f5f3 100644 (file)
@@ -328,7 +328,7 @@ vms_seek_read (wtap *wth, gint64 seek_off,
 
     if (pkt_len != len) {
         if (pkt_len != -1) {
-            *err = WTAP_ERR_BAD_RECORD;
+            *err = WTAP_ERR_BAD_FILE;
             *err_info = g_strdup_printf("vms: requested length %d doesn't match length %d",
                 len, pkt_len);
         }
@@ -416,7 +416,7 @@ parse_vms_rec_hdr(wtap *wth, FILE_T fh, int *err, gchar **err_info)
            /* if unknown format then exit with error        */
            /* We will need to add code to handle new format */
            if (num_items_scanned != 8) {
-               *err = WTAP_ERR_BAD_RECORD;
+               *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("vms: header line not valid");
                return -1;
            }
@@ -427,7 +427,7 @@ parse_vms_rec_hdr(wtap *wth, FILE_T fh, int *err, gchar **err_info)
                 p++;
 
             if ( !*p ) {
-                *err = WTAP_ERR_BAD_RECORD;
+                *err = WTAP_ERR_BAD_FILE;
                *err_info = g_strdup_printf("vms: Length field not valid");
                 return -1;
             }
@@ -487,7 +487,7 @@ parse_vms_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err,
        }
        if (!parse_single_hex_dump_line(line, buf, i,
                                        offset, pkt_len - i)) {
-            *err = WTAP_ERR_BAD_RECORD;
+            *err = WTAP_ERR_BAD_FILE;
            *err_info = g_strdup_printf("vms: hex dump not valid");
             return FALSE;
         }
index 464023103b6a70c1b6967fcb246a4e286220890f..530a573f8687695d7aad57e00f144bc45c5979f5 100644 (file)
@@ -605,7 +605,7 @@ static const char *wtap_errlist[] = {
        NULL,
        NULL,
        "Less data was read than was expected",
-       "File contains a record that's not valid",
+       "The file appears to be damaged or corrupt.",
        "Less data was written than was requested",
        "Uncompression error: data oddly truncated",
        "Uncompression error: data would overflow buffer",
index 91fea6a25bba8c2d3e4ab994dcea31d0297911ab..8355c76f2b673cfb3c7b60aeaade2bfc995853fd 100644 (file)
@@ -1004,8 +1004,8 @@ int wtap_register_encap_type(char* name, char* short_name);
        /* An attempt to read failed, reason unknown */
 #define        WTAP_ERR_SHORT_READ                     -12
        /* An attempt to read read less data than it should have */
-#define        WTAP_ERR_BAD_RECORD                     -13
-       /* We read an invalid record */
+#define        WTAP_ERR_BAD_FILE                       -13
+       /* The file appears to be damaged or corrupted or otherwise bogus */
 #define        WTAP_ERR_SHORT_WRITE                    -14
        /* An attempt to write wrote less data than it should have */
 #define        WTAP_ERR_UNC_TRUNCATED                  -15