Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2004 09:23:47 -0600
From:      "Jacques A. Vidrine" <nectar@FreeBSD.org>
To:        Don Lewis <truckman@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern uipc_syscalls.c
Message-ID:  <20040110152347.GD80448@madman.celabo.org>
In-Reply-To: <200401100828.i0A8SsZP047883@repoman.freebsd.org>
References:  <200401100828.i0A8SsZP047883@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 10, 2004 at 12:28:54AM -0800, Don Lewis wrote:
> truckman    2004/01/10 00:28:54 PST
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/kern             uipc_syscalls.c 
>   Log:
>   Add a somewhat redundant check on the len arguement to getsockaddr() to
>   avoid relying on the minimum memory allocation size to avoid problems.
>   The check is somewhat redundant because the consumers of the returned
>   structure will check that sa_len is a protocol-specific larger size.
>   
>   Submitted by:   Matthew Dillon <dillon@apollo.backplane.com>
>   Reviewed by:    nectar
>   MFC after:      30 days

But the check *is not* redundant.  The consumers cannot safely check
sa_len if the allocation were to be less than `offsetof(struct
sa_sockaddr, data[0])'--- which it never is, by chance, due to the
minimum memory allocation size, as you noted.  But we shall all feel
better that this is made explicit.  FWIW, I think the check should
have been for `sizeof(*sa)' technically, but what has been committed
is safe, too, I believe.

Cheers,
-- 
Jacques Vidrine   NTT/Verio SME      FreeBSD UNIX       Heimdal
nectar@celabo.org jvidrine@verio.net nectar@freebsd.org nectar@kth.se



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040110152347.GD80448>