forked from osmocom/wireshark
Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
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=40175daniel/osmux
parent
1df4ee9109
commit
d94bd07f99
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
|
|
8
file.c
8
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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
4
tshark.c
4
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"
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||