From 1a722c1b7882efeea9be30e36ea85ef355e53ed4 Mon Sep 17 00:00:00 2001 From: bol-van Date: Tue, 29 Oct 2024 18:30:40 +0300 Subject: [PATCH] nfqws,tpws: fix invalid port filter message --- nfq/nfqws.c | 6 ++++-- tpws/tpws.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/nfq/nfqws.c b/nfq/nfqws.c index 39699bd..554282f 100644 --- a/nfq/nfqws.c +++ b/nfq/nfqws.c @@ -673,6 +673,7 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl) { char *e,*p,c; port_filter pf; + bool b; for (p=opt ; p ; ) { @@ -682,9 +683,10 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl) *e=0; } - if (!pf_parse(p,&pf) || !port_filter_add(pfl,&pf)) return false; - + b = pf_parse(p,&pf) && port_filter_add(pfl,&pf); if (e) *e++=c; + if (!b) return false; + p = e; } return true; diff --git a/tpws/tpws.c b/tpws/tpws.c index 4f6eb76..ca45c27 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -335,6 +335,7 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl) { char *e,*p,c; port_filter pf; + bool b; for (p=opt ; p ; ) { @@ -344,9 +345,10 @@ static bool parse_pf_list(char *opt, struct port_filters_head *pfl) *e=0; } - if (!pf_parse(p,&pf) || !port_filter_add(pfl,&pf)) return false; - + b = pf_parse(p,&pf) && port_filter_add(pfl,&pf); if (e) *e++=c; + if (!b) return false; + p = e; } return true;