Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Nov 2009 10:00:08 GMT
From:      Bruce Evans <brde@optusnet.com.au>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/140690: [libc] [patch] swab(3) with negative len should do nothing
Message-ID:  <200911211000.nALA08Lf032036@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/140690; it has been noted by GNATS.

From: Bruce Evans <brde@optusnet.com.au>
To: Paul Procacci <pprocacci@datapipe.com>
Cc: bug-followup@freebsd.org
Subject: Re: kern/140690: [libc] [patch] swab(3) with negative len should do
 nothing
Date: Sat, 21 Nov 2009 20:59:35 +1100 (EST)

 On Sat, 21 Nov 2009, Paul Procacci wrote:
 
 > I'd like to add to this.
 >
 > As for the length argument.  Is there really ever a time it would have
 > to be signed?
 >
 > If not, then I would suggest declaring the type as size_t and not
 > ssize_t much like the read/write/etc syscalls.
 
 The type should be unsigned (size_t), and was unsigned (size_t) in
 BSD, but it is broken in POSIX (ssize_t), and FreeBSD changed the API
 to be not even bug for bug compatible with POSIX in 2004 (since POSIX
 requires nothing to be done when the length is negative, like the patch
 in the PR implements).
 
 The type was implicit int in V7, but BSD changed it to size_t in Net/2
 or earlier; thus the type and the the code were correct in all versions
 of FreeBSD between 1993 and 2004.
 
 Bruce



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