Re: [PATCH 03/12] Prevent renaming interfaces to empty string.

Stephen Hemminger
2007-10-12T17:09:07Z

On Fri, 12 Oct 2007 10:56:38 +0200
Andreas Henriksson <andreas@fatal.se> wrote:

> From: Alexander Wirt <formorer@debian.org>
>
>
> Signed-off-by: Andreas Henriksson <andreas@fatal.se>
> ---
> ip/iplink.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 4060845..da1f64e 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -670,6 +670,10 @@ static int do_set(int argc, char **argv)
> }
>
> if (newname && strcmp(dev, newname)) {
> + if (strlen(newname) == 0) {
> + printf("\"\" is not valid device identifier\n");
> + return -1;
> + }
> if (do_changename(dev, newname) < 0)
> return -1;
> dev = newname;

The kernel should already be preventing this?

--
Stephen Hemminger <shemminger@linux-foundation.org>