aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/pcapng.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-03-05 09:32:21 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-03-05 09:32:21 +0000
commitddd69f477506a88b03389a0d43b0c0f63583d521 (patch)
tree45a76df092ff295f5672ef479a6121f42b9b9674 /wiretap/pcapng.c
parenta20cfcc745f6fc0f1bba7dbb6255bb4fbe34c6a9 (diff)
Use correct lenght when writing if_filter_str.
svn path=/trunk/; revision=41352
Diffstat (limited to 'wiretap/pcapng.c')
-rw-r--r--wiretap/pcapng.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index a2841d0227..8c46b022ba 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -2722,6 +2722,7 @@ pcapng_write_if_descr_block(wtap_dumper *wdh, wtapng_if_descr_t *int_data, int *
if (if_filter_str_len !=0) {
option_hdr.type = IDB_OPT_IF_FILTER;
option_hdr.value_length = if_filter_str_len;
+ /* if_filter_str_len includes the leading byte indicating filter type (libpcap str or BPF code) */
if (!wtap_dump_file_write(wdh, &option_hdr, 4, err))
return FALSE;
wdh->bytes_dumped += 4;
@@ -2733,7 +2734,8 @@ pcapng_write_if_descr_block(wtap_dumper *wdh, wtapng_if_descr_t *int_data, int *
/* Write the comments string */
pcapng_debug3("pcapng_write_if_descr_block, if_filter_str:'%s' if_filter_str_len %u if_filter_str_pad_len %u" , int_data->if_filter_str, if_filter_str_len, if_filter_str_len);
- if (!wtap_dump_file_write(wdh, int_data->if_filter_str, if_filter_str_len, err))
+ /* if_filter_str_len includes the leading byte indicating filter type (libpcap str or BPF code) */
+ if (!wtap_dump_file_write(wdh, int_data->if_filter_str, if_filter_str_len-1, err))
return FALSE;
wdh->bytes_dumped += comment_len;