[PATCH] netfilter: nf_conntrack_sip: fix parsing error

From: Tong Zhang
Date: Sat Aug 15 2020 - 18:03:05 EST


ct_sip_parse_numerical_param can only return 0 or 1, but the caller is
checking parsing error using < 0

Signed-off-by: Tong Zhang <ztong0001@xxxxxxxxx>
---
net/netfilter/nf_conntrack_sip.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_sip.c b/net/netfilter/nf_conntrack_sip.c
index b83dc9bf0a5d..08873694120a 100644
--- a/net/netfilter/nf_conntrack_sip.c
+++ b/net/netfilter/nf_conntrack_sip.c
@@ -1269,7 +1269,7 @@ static int process_register_request(struct sk_buff *skb, unsigned int protoff,

if (ct_sip_parse_numerical_param(ct, *dptr,
matchoff + matchlen, *datalen,
- "expires=", NULL, NULL, &expires) < 0) {
+ "expires=", NULL, NULL, &expires) == 0) {
nf_ct_helper_log(skb, ct, "cannot parse expires");
return NF_DROP;
}
@@ -1375,7 +1375,7 @@ static int process_register_response(struct sk_buff *skb, unsigned int protoff,
matchoff + matchlen,
*datalen, "expires=",
NULL, NULL, &c_expires);
- if (ret < 0) {
+ if (ret == 0) {
nf_ct_helper_log(skb, ct, "cannot parse expires");
return NF_DROP;
}
--
2.25.1