IPVS: ip_vs_pe.c, use strncmp to be safe.
Subsystems (3)
PATCH 1/1 IPVS: ip_vs_pe.c, use strncmp to be safe.
With pe data traveling between master and backup,
strcmp should not be used.
How knows what size it will have in future.
To be safe use strncmp.
--- net/netfilter/ipvs/ip_vs_pe.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
net/netfilter/ipvs/ip_vs_pe.c +2 -2
@@ -46,7 +46,7 @@ ip_vs_pe_getbyname(const char *pe_name)/* This pe is just deleted */ continue ; } -if (strcmp (pe_name, pe->name)==0 ) { +if (strncmp (pe_name, pe->name,IP_VS_PENAME_MAXLEN )==0 ) {/* HIT */ spin_unlock_bh (&ip_vs_pe_lock);return pe;
@@ -104,7 +104,7 @@ int register_ip_vs_pe(struct ip_vs_pe *pe)* in the pe list. */ list_for_each_entry (tmp, &ip_vs_pe, n_list) { -if (strcmp (tmp->name, pe->name) ==0 ) { +if (strncmp (tmp->name, pe->name,IP_VS_PENAME_MAXLEN ) ==0 ) {spin_unlock_bh (&ip_vs_pe_lock);ip_vs_use_count_dec (); pr_err("%s(): [%s] pe already existed "
Signature · 1 line
1.6.0.2
Simon Horman
maintainerQuoted 5 lines · Hans Schillstrom
With pe data traveling between master and backup,
strcmp should not be used.
How knows what size it will have in future.To be safe use strncmp.
Hi Hans,
I'm not entirely convinced this is necessary, but
its better to be safe than sorry.
Quoted 1 line
Signed-off-by Hans Schillstrom <[email protected]>
Patrick, I assume that nf-next-2.6 is currently closed. I'll push this to you once it opens again.
Quoted 34 lines
--- net/netfilter/ipvs/ip_vs_pe.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)net/netfilter/ipvs/ip_vs_pe.c +2
-2@@ -46,7 +46,7 @@ ip_vs_pe_getbyname(const char *pe_name)/* This pe is just deleted */ continue ; } -if (strcmp (pe_name, pe->name)==0 ) { +if (strncmp (pe_name, pe->name,IP_VS_PENAME_MAXLEN )==0 ) {/* HIT */ spin_unlock_bh (&ip_vs_pe_lock);return pe;@@ -104,7 +104,7 @@ int register_ip_vs_pe(struct ip_vs_pe *pe)* in the pe list. */ list_for_each_entry (tmp, &ip_vs_pe, n_list) { -if (strcmp (tmp->name, pe->name) ==0 ) { +if (strncmp (tmp->name, pe->name,IP_VS_PENAME_MAXLEN ) ==0 ) {spin_unlock_bh (&ip_vs_pe_lock);ip_vs_use_count_dec (); pr_err("%s(): [%s] pe already existed "Signature · 6 lines
1.6.0.2 -- To unsubscribe from this list: send the line "unsubscribe lvs-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Simon Horman
Quoted 5 lines · Hans Schillstrom
With pe data traveling between master and backup,
strcmp should not be used.
How knows what size it will have in future.To be safe use strncmp.
Hi Hans,
Quoted 7 lines
I'm not entirely convinced this is necessary, but
its better to be safe than sorry.Quoted 1 line
Signed-off-by Hans Schillstrom <[email protected]>Patrick, I assume that nf-next-2.6 is currently closed. I'll push this to you once it opens again.
Thanks, I'll open up nf-next once Dave opens net-next.