aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-01-22 00:26:36 +0000
committerGuy Harris <guy@alum.mit.edu>2014-01-22 00:26:36 +0000
commit90d7c5f59b574e254bc1bb70aaaf12372fe97cc3 (patch)
tree7bc8e69b7cc459b8dfef190d1b33a7cb092a7bf3 /file.c
parent5c825d6a364d83dace7b6c682aa47678e89df79b (diff)
downloadwireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.tar.gz
wireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.tar.bz2
wireshark-90d7c5f59b574e254bc1bb70aaaf12372fe97cc3.zip
Don't write out packets that have a "captured length" bigger than we're
willing to read or that's bigger than will fit in the file format; instead, report an error. For the "I can't write a packet of that type in that file type" error, report the file type in question. svn path=/trunk/; revision=54882
Diffstat (limited to 'file.c')
-rw-r--r--file.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/file.c b/file.c
index 4b66bb99c0..1603d95784 100644
--- a/file.c
+++ b/file.c
@@ -1625,8 +1625,9 @@ cf_merge_files(char **out_filenamep, int in_file_count,
case WTAP_ERR_UNSUPPORTED_ENCAP:
/*
- * This is a problem with the particular frame we're writing;
- * note that, and give the frame number.
+ * This is a problem with the particular frame we're writing and
+ * the file type and subtype we're writing; note that, and report
+ * the frame number and file type/subtype.
*/
display_basename = g_filename_display_basename(in_file->filename);
simple_error_message_box(
@@ -1636,6 +1637,20 @@ cf_merge_files(char **out_filenamep, int in_file_count,
g_free(display_basename);
break;
+ case WTAP_ERR_PACKET_TOO_LARGE:
+ /*
+ * This is a problem with the particular frame we're writing and
+ * the file type and subtype we're writing; note that, and report
+ * the frame number and file type/subtype.
+ */
+ display_basename = g_filename_display_basename(in_file->filename);
+ simple_error_message_box(
+ "Frame %u of \"%s\" is too large for a \"%s\" file.",
+ in_file->packet_num, display_basename,
+ wtap_file_type_subtype_string(file_type));
+ g_free(display_basename);
+ break;
+
default:
display_basename = g_filename_display_basename(out_filename);
simple_error_message_box(
@@ -4147,14 +4162,26 @@ save_packet(capture_file *cf _U_, frame_data *fdata,
case WTAP_ERR_UNSUPPORTED_ENCAP:
/*
- * This is a problem with the particular frame we're writing;
- * note that, and give the frame number.
+ * This is a problem with the particular frame we're writing and
+ * the file type and subtype we're writing; note that, and report
+ * the frame number and file type/subtype.
*/
simple_error_message_box(
"Frame %u has a network type that can't be saved in a \"%s\" file.",
fdata->num, wtap_file_type_subtype_string(args->file_type));
break;
+ case WTAP_ERR_PACKET_TOO_LARGE:
+ /*
+ * This is a problem with the particular frame we're writing and
+ * the file type and subtype we're writing; note that, and report
+ * the frame number and file type/subtype.
+ */
+ simple_error_message_box(
+ "Frame %u is larger than Wireshark supports in a \"%s\" file.",
+ fdata->num, wtap_file_type_subtype_string(args->file_type));
+ break;
+
default:
display_basename = g_filename_display_basename(args->fname);
simple_error_message_box(