[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20080701.195730.231191074.davem@davemloft.net>
Date: Tue, 01 Jul 2008 19:57:30 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: wangchen@...fujitsu.com
Cc: bhutchings@...arflare.com, netdev@...r.kernel.org
Subject: Re: V2 [PATCH] netdevice: Fix wrong string handle in kernel
command line parsing
From: Wang Chen <wangchen@...fujitsu.com>
Date: Tue, 01 Jul 2008 08:56:40 +0800
> Ben Hutchings said the following on 2008-6-30 18:25:
> >> - strcpy(s[i].name, name);
> >> + strncpy(s[i].name, name, IFNAMSIZ);
> >
> > I think that strncpy() should be strlcpy(), because strncpy() does not
> > ensure null-termination.
> >
>
> Of course. Thanks, Ben.
>
> v1->v2: Use strlcpy() to ensure s[i].name be null-termination.
>
> 1. In netdev_boot_setup_add(), a long name will leak.
> ex. : dev=21,0x1234,0x1234,0x2345,eth123456789verylongname.........
> 2. In netdev_boot_setup_check(), mismatch will happen if s[i].name
> is a substring of dev->name.
> ex. : dev=...eth1 dev=...eth11
>
> Signed-off-by: Wang Chen <wangchen@...fujitsu.com>
Looks good, applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists