summaryrefslogtreecommitdiffstats
path: root/wiretap/merge.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:15:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:15:53 +0000
commit41ee6846b4605bf50f1f5b12acffc71a76257e5d (patch)
tree78044e6ed77e26ebcdb14ac483f29d508d88a92d /wiretap/merge.c
parentAdding debian version 4.2.5-2. (diff)
downloadwireshark-41ee6846b4605bf50f1f5b12acffc71a76257e5d.tar.xz
wireshark-41ee6846b4605bf50f1f5b12acffc71a76257e5d.zip
Merging upstream version 4.2.6.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--wiretap/merge.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/wiretap/merge.c b/wiretap/merge.c
index 82154f9b..3c007dd6 100644
--- a/wiretap/merge.c
+++ b/wiretap/merge.c
@@ -1420,6 +1420,22 @@ merge_files(const gchar* out_filename, const int file_type,
guint32 *err_framenum)
{
ws_assert(out_filename != NULL);
+ ws_assert(in_file_count > 0);
+ ws_assert(in_filenames != NULL);
+ ws_assert(err_info != NULL);
+
+ /* #19402: ensure we aren't appending to one of our inputs */
+ if (do_append) {
+ unsigned int i;
+ for (i = 0; i < in_file_count; i++) {
+ if (files_identical(out_filename, in_filenames[i])) {
+ *err_info = ws_strdup_printf("Output file %s is same as input file %s; "
+ "appending would create infinite loop",
+ out_filename, in_filenames[i]);
+ return MERGE_ERR_INVALID_OPTION;
+ }
+ }
+ }
return merge_files_common(out_filename, NULL, NULL,
file_type, in_filenames, in_file_count,