* [PATCH] IPVS: ip_vs_pe.c, use strncmp to be safe.
@ 2010-10-27 15:05 Hans Schillstrom
2010-10-28 7:56 ` Simon Horman
0 siblings, 1 reply; 3+ messages in thread
From: Hans Schillstrom @ 2010-10-27 15:05 UTC (permalink / raw)
To: lvs-devel, horms, ja, wensong; +Cc: 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.
Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
---
net/netfilter/ipvs/ip_vs_pe.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_pe.c b/net/netfilter/ipvs/ip_vs_pe.c
index 3414af7..baab44f 100644
--- a/net/netfilter/ipvs/ip_vs_pe.c
+++ b/net/netfilter/ipvs/ip_vs_pe.c
@@ -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 "
--
1.6.0.2
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] IPVS: ip_vs_pe.c, use strncmp to be safe.
2010-10-27 15:05 [PATCH] IPVS: ip_vs_pe.c, use strncmp to be safe Hans Schillstrom
@ 2010-10-28 7:56 ` Simon Horman
2010-10-28 10:33 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2010-10-28 7:56 UTC (permalink / raw)
To: Hans Schillstrom; +Cc: lvs-devel, ja, wensong, Patrick McHardy
On Wed, Oct 27, 2010 at 05:05:00PM +0200, Hans Schillstrom wrote:
> 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.
> Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Patrick, I assume that nf-next-2.6 is currently closed.
I'll push this to you once it opens again.
> ---
> net/netfilter/ipvs/ip_vs_pe.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_pe.c b/net/netfilter/ipvs/ip_vs_pe.c
> index 3414af7..baab44f 100644
> --- a/net/netfilter/ipvs/ip_vs_pe.c
> +++ b/net/netfilter/ipvs/ip_vs_pe.c
> @@ -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 "
> --
> 1.6.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] IPVS: ip_vs_pe.c, use strncmp to be safe.
2010-10-28 7:56 ` Simon Horman
@ 2010-10-28 10:33 ` Patrick McHardy
0 siblings, 0 replies; 3+ messages in thread
From: Patrick McHardy @ 2010-10-28 10:33 UTC (permalink / raw)
To: Simon Horman; +Cc: Hans Schillstrom, lvs-devel, ja, wensong
On 28.10.2010 09:56, Simon Horman wrote:
> On Wed, Oct 27, 2010 at 05:05:00PM +0200, Hans Schillstrom wrote:
>> 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.
>
>> Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
>
> 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-28 10:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-27 15:05 [PATCH] IPVS: ip_vs_pe.c, use strncmp to be safe Hans Schillstrom
2010-10-28 7:56 ` Simon Horman
2010-10-28 10:33 ` Patrick McHardy
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.