Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 Mar 2003 20:25:30 -0500
From:      Barney Wolff <barney@pit.databus.com>
To:        Jens Rehsack <rehsack@liwing.de>
Cc:        Juli Mallett <jmallett@FreeBSD.ORG>, current@FreeBSD.ORG
Subject:   Re: PATCH: type errors in src-tree
Message-ID:  <20030302012530.GA65162@pit.databus.com>
In-Reply-To: <3E61560D.2070205@liwing.de>
References:  <3E5EA13E.9020208@liwing.de> <3E60F1CF.2030400@liwing.de> <20030301155546.A39174@FreeBSD.org> <3E612F7F.1090002@liwing.de> <20030301233642.GA64401@pit.databus.com> <3E614A06.5070403@liwing.de> <20030301180920.A53976@FreeBSD.org> <3E61560D.2070205@liwing.de>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an example of what I was pointing out:

On Sun, Mar 02, 2003 at 01:53:33AM +0100, Jens Rehsack wrote:
 ...
> @@ -1444,22 +1420,19 @@
>   *	none	- response sent
>   *
>   */
> -void
> -send_resp ( intf, Hdr, resp )
> -	int		intf;
> -	Snmp_Header	*Hdr;
> -	u_char		*resp;
> +static void
> +send_resp ( const int intf, Snmp_Header *Hdr, char *resp )
>  {
>  	int	n;
>  
> -	if ( ilmi_fd[intf] > 0 ) {
> -	    n = write ( ilmi_fd[intf], (caddr_t)&resp[1], resp[0] );
> +	if ( ilmi_fd[intf] > 0 ) { /* FIXME: does ilmi_fd[intf] exists? out of range? */
> +	    n = write ( ilmi_fd[intf], resp+1, resp[0] );
 ...

Here's a case where it matters whether something is u_char or char.
write(2) takes a size_t as its third arg, and extension of a char to
that may not be the same as for u_char, for example on Sparc.  If the
response is ever >127 bytes, this will fail.  You're going to have to
look carefully at how things are used to see when char is appropriate
and when u_char is necessary.

-- 
Barney Wolff         http://www.databus.com/bwresume.pdf
I'm available by contract or FT, in the NYC metro area or via the 'Net.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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