bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] Fix some minor issues.


From: Sergiu Ivanov
Subject: Re: [PATCH 1/2] Fix some minor issues.
Date: Thu, 24 Dec 2009 22:25:47 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hello,

On Mon, Aug 10, 2009 at 11:11:41PM +0300, Sergiu Ivanov wrote:
>
> diff --git a/eth-multiplexer/vdev.c b/eth-multiplexer/vdev.c
> index dac9802..6fb88d0 100644
> --- a/eth-multiplexer/vdev.c
> +++ b/eth-multiplexer/vdev.c
> @@ -135,7 +135,10 @@ add_vdev (char *name, int size,
>  
>    vdev->dev_port = ports_get_right (vdev);
>    ports_port_deref (vdev);
> -  strncpy (vdev->name, name, IFNAMSIZ);
> +  if (name)
> +    strncpy (vdev->name, name, IFNAMSIZ);
> +  else
> +    vdev->name[0] = 0;
>    vdev->if_header_size = ETH_HLEN;
>    vdev->if_mtu = ETH_MTU;
>    vdev->if_header_format = HDR_ETHERNET;

Zheng asked whether one could lookup a NULL filename (and the name
argument of add_vdev is always derived from that filename).  While I
cannot give a definite answer to this question (because it wasn't this
question that I investigated), I have just found a silly mistake in
ordering if statements in the handling of .MASTER node which caused a
gratuitous call to add_vdev with name = NULL.  Taking into
consideration the fact that the comparison of openstat against mode
should also stay in its original version, this patch should
theoretically be abrogated.

Still, I somehow feel bad about copying from a pointer without doing
an extra check.  Would it be an acceptable idea to assert (name) ?

Regards,
scolobb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]