From e27759aa56732ec1423a104333c1d88f5ddd7efb Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 17 May 2024 17:00:51 +0200 Subject: Adding upstream version 4.2.5. Signed-off-by: Daniel Baumann --- writecap/pcapio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'writecap/pcapio.c') diff --git a/writecap/pcapio.c b/writecap/pcapio.c index e5a8c9d..58c4917 100644 --- a/writecap/pcapio.c +++ b/writecap/pcapio.c @@ -425,7 +425,7 @@ pcapng_write_interface_description_block(FILE* pfile, } /* 11 - IDB_FILTER */ - if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < UINT16_MAX)) { + if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < UINT16_MAX - 1)) { /* No, this isn't a string, it has an extra type byte */ options_length += (uint32_t)(sizeof(struct ws_option) + (uint16_t)(ADD_PADDING(strlen(filter)+ 1))); @@ -496,7 +496,8 @@ pcapng_write_interface_description_block(FILE* pfile, } /* 11 - IDB_FILTER - write filter string if applicable - * We only write version 1 of the filter, pcapng string + * We write out the libpcap filter expression, not the + * generated BPF code. */ if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < UINT16_MAX - 1)) { option.type = IDB_FILTER; -- cgit v1.2.3