From 982fc7184d46621948e53b485c7504c9d11f3350 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 17 May 2024 17:00:59 +0200 Subject: Merging upstream version 4.2.5. Signed-off-by: Daniel Baumann --- editcap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'editcap.c') diff --git a/editcap.c b/editcap.c index ef99e507..8c03af3f 100644 --- a/editcap.c +++ b/editcap.c @@ -1943,6 +1943,10 @@ main(int argc, char *argv[]) } while (nstime_cmp(&rec->ts, &block_next) > 0) { /* time for the next file */ + /* We presumably want to write the DSBs from files given + * on the command line to every file. + */ + wtap_block_array_ref(params.dsbs_initial); if (!wtap_dump_close(pdh, NULL, &write_err, &write_err_info)) { cfile_close_failure_message(filename, write_err, write_err_info); @@ -1978,6 +1982,11 @@ main(int argc, char *argv[]) if (split_packet_count != 0) { /* time for the next file? */ if (written_count > 0 && (written_count % split_packet_count) == 0) { + + /* We presumably want to write the DSBs from files given + * on the command line to every file. + */ + wtap_block_array_ref(params.dsbs_initial); if (!wtap_dump_close(pdh, NULL, &write_err, &write_err_info)) { cfile_close_failure_message(filename, write_err, write_err_info); @@ -2594,7 +2603,7 @@ handle_chopping(chop_t chop, wtap_packet_header *out_phdr, if (chop.off_begin_pos > 0) { memmove(*buf + chop.off_begin_pos, *buf + chop.off_begin_pos + chop.len_begin, - out_phdr->caplen - chop.len_begin); + out_phdr->caplen - (chop.off_begin_pos + chop.len_begin)); } else { *buf += chop.len_begin; } -- cgit v1.2.3