diff --git a/capinfos.c b/capinfos.c index b2e0d4ea98..c2f2e8ed4c 100644 --- a/capinfos.c +++ b/capinfos.c @@ -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; diff --git a/capture_info.c b/capture_info.c index 0856cee2f6..48102d9474 100644 --- a/capture_info.c +++ b/capture_info.c @@ -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" diff --git a/editcap.c b/editcap.c index 67badb1f62..a36dfa9958 100644 --- 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 f63abd69c6..c87d5dbb4b 100644 --- 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" diff --git a/mergecap.c b/mergecap.c index 997613c31a..0061622b95 100644 --- a/mergecap.c +++ b/mergecap.c @@ -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; diff --git a/rawshark.c b/rawshark.c index e694fa2ef3..e900257d13 100644 --- a/rawshark.c +++ b/rawshark.c @@ -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; diff --git a/tshark.c b/tshark.c index 375e5a8b43..d33aa3b711 100644 --- 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" diff --git a/wiretap/5views.c b/wiretap/5views.c index 7fd391cbbb..eb8879813d 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -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; diff --git a/wiretap/aethra.c b/wiretap/aethra.c index 912e94ddab..ae53423785 100644 --- a/wiretap/aethra.c +++ b/wiretap/aethra.c @@ -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; diff --git a/wiretap/airopeek9.c b/wiretap/airopeek9.c index b959cbaf02..44a520b52f 100644 --- a/wiretap/airopeek9.c +++ b/wiretap/airopeek9.c @@ -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: 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: 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: 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: 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; diff --git a/wiretap/ascendtext.c b/wiretap/ascendtext.c index dd8e750dd8..612a202b09 100644 --- a/wiretap/ascendtext.c +++ b/wiretap/ascendtext.c @@ -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; } diff --git a/wiretap/ber.c b/wiretap/ber.c index fba02f240f..e426246d0a 100644 --- a/wiretap/ber.c +++ b/wiretap/ber.c @@ -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; diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c index 374ea83db5..8863f8967f 100644 --- a/wiretap/btsnoop.c +++ b/wiretap/btsnoop.c @@ -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; diff --git a/wiretap/commview.c b/wiretap/commview.c index befa2399bf..31aa385646 100644 --- a/wiretap/commview.c +++ b/wiretap/commview.c @@ -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; } diff --git a/wiretap/cosine.c b/wiretap/cosine.c index c8f695241d..390070024b 100644 --- a/wiretap/cosine.c +++ b/wiretap/cosine.c @@ -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; } diff --git a/wiretap/csids.c b/wiretap/csids.c index 2b5226e402..093d8eb4b5 100644 --- a/wiretap/csids.c +++ b/wiretap/csids.c @@ -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; diff --git a/wiretap/daintree-sna.c b/wiretap/daintree-sna.c index 113ed4a78f..d9094c4452 100644 --- a/wiretap/daintree-sna.c +++ b/wiretap/daintree-sna.c @@ -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; } diff --git a/wiretap/dbs-etherwatch.c b/wiretap/dbs-etherwatch.c index 0d9f753f35..366a118aba 100644 --- a/wiretap/dbs-etherwatch.c +++ b/wiretap/dbs-etherwatch.c @@ -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; } diff --git a/wiretap/dct3trace.c b/wiretap/dct3trace.c index 77611543e2..12910bebac 100644 --- a/wiretap/dct3trace.c +++ b/wiretap/dct3trace.c @@ -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; } diff --git a/wiretap/erf.c b/wiretap/erf.c index 7b111d3d29..c5dc837927 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -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; diff --git a/wiretap/etherpeek.c b/wiretap/etherpeek.c index bf4674c896..e28b373f0e 100644 --- a/wiretap/etherpeek.c +++ b/wiretap/etherpeek.c @@ -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; } diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 8ca55bf9ee..c2bf571e7c 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -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; diff --git a/wiretap/hcidump.c b/wiretap/hcidump.c index 104d9f918c..07242fe4e1 100644 --- a/wiretap/hcidump.c +++ b/wiretap/hcidump.c @@ -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; diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index ac2336ce40..ce6421aefc 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -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; diff --git a/wiretap/ipfix.c b/wiretap/ipfix.c index 5bd08f58b2..cdfcdc53e9 100644 --- a/wiretap/ipfix.c +++ b/wiretap/ipfix.c @@ -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); diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index 91fd750b5c..b9a382c810 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -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; diff --git a/wiretap/iseries.c b/wiretap/iseries.c index 103bf70ae2..526840e812 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -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; } diff --git a/wiretap/k12.c b/wiretap/k12.c index d41ccac06e..0ff3d68f16 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -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; } diff --git a/wiretap/k12text.l b/wiretap/k12text.l index fae1d62350..687ef92849 100644 --- a/wiretap/k12text.l +++ b/wiretap/k12text.l @@ -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; } diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index 2c049297f0..5fbf8714c2 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -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; } diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index c8e5cb7d74..c5d1b31738 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -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; } diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 674866fa17..ea57240f90 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -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; } diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c index dadc4a6679..e3c29e70f3 100644 --- a/wiretap/netscreen.c +++ b/wiretap/netscreen.c @@ -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; } diff --git a/wiretap/nettl.c b/wiretap/nettl.c index e265b45da9..735fe9edf7 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -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; diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c index d706e222f4..97ae73ef45 100644 --- a/wiretap/network_instruments.c +++ b/wiretap/network_instruments.c @@ -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; diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 73625b90bc..4c0291fbd2 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -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; } diff --git a/wiretap/packetlogger.c b/wiretap/packetlogger.c index afe918f9a9..7e03b79a52 100644 --- a/wiretap/packetlogger.c +++ b/wiretap/packetlogger.c @@ -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; } diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index baf6ed007e..25a2be444c 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -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; diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index bf233a15f8..f5aff4066f 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -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; diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c index c483b8a1d8..46465bca7a 100644 --- a/wiretap/pppdump.c +++ b/wiretap/pppdump.c @@ -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; diff --git a/wiretap/snoop.c b/wiretap/snoop.c index ebda14ce94..9df367a413 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -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; diff --git a/wiretap/tnef.c b/wiretap/tnef.c index 1fca687805..d43ffc9270 100644 --- a/wiretap/tnef.c +++ b/wiretap/tnef.c @@ -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; diff --git a/wiretap/toshiba.c b/wiretap/toshiba.c index 2072ccddc2..921bd988aa 100644 --- a/wiretap/toshiba.c +++ b/wiretap/toshiba.c @@ -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; } diff --git a/wiretap/visual.c b/wiretap/visual.c index e6998ce3d4..e516f14e64 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -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; diff --git a/wiretap/vms.c b/wiretap/vms.c index 89b5c833e7..109b20964d 100644 --- a/wiretap/vms.c +++ b/wiretap/vms.c @@ -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; } diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 464023103b..530a573f86 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -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", diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 91fea6a25b..8355c76f2b 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -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