The "len" variable is shadowed within a function, so rename inner use to
the more descriptive "filter_len" to fix the issue.

Fixes: d1da6d0d04c7 ("pcapng: require per-interface information")
Cc: [email protected]

Signed-off-by: Bruce Richardson <[email protected]>
---
 lib/pcapng/rte_pcapng.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/pcapng/rte_pcapng.c b/lib/pcapng/rte_pcapng.c
index 21bc94cea1..2cc9e2040d 100644
--- a/lib/pcapng/rte_pcapng.c
+++ b/lib/pcapng/rte_pcapng.c
@@ -296,16 +296,15 @@ rte_pcapng_add_interface(rte_pcapng_t *self, uint16_t 
port, uint16_t link_type,
                opt = pcapng_add_option(opt, PCAPNG_IFB_HARDWARE,
                                         ifhw, strlen(ifhw));
        if (filter) {
-               size_t len;
+               const size_t filter_len = strlen(filter) + 1;
 
-               len = strlen(filter) + 1;
                opt->code = PCAPNG_IFB_FILTER;
-               opt->length = len;
+               opt->length = filter_len;
                /* Encoding is that the first octet indicates string vs BPF */
                opt->data[0] = 0;
                memcpy(opt->data + 1, filter, strlen(filter));
 
-               opt = (struct pcapng_option *)((uint8_t *)opt + 
pcapng_optlen(len));
+               opt = (struct pcapng_option *)((uint8_t *)opt + 
pcapng_optlen(filter_len));
        }
 
        opt = pcapng_add_option(opt, PCAPNG_OPT_END, NULL, 0);
-- 
2.48.1

Reply via email to