Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Dec 1998 17:54:30 +0100
From:      Eivind Eklund <eivind@yes.no>
To:        cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/lib/libc/gen getpwent.c
Message-ID:  <19981217175430.B93539@follo.net>
In-Reply-To: <199812171631.IAA26960@freefall.freebsd.org>; from Eivind Eklund on Thu, Dec 17, 1998 at 08:31:03AM -0800
References:  <199812171631.IAA26960@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 17, 1998 at 08:31:03AM -0800, Eivind Eklund wrote:
> eivind      1998/12/17 08:31:02 PST
> 
>   Modified files:
>     lib/libc/gen         getpwent.c 
>   Log:
>   Restore old semantics (broken in rev 1.47's buffer overflow fix).

There have previously been two attempts to fix this problem by
truncation.  None of them have been quite right - the two-line fixup
of the fix was done by one FreeBSD committer and reviewed by another,
and still was wrong (no longer overflowable, but wrong semantics).

This illustrate a point I have made repeatedly, both on Bugtraq and in
various *BSD-lists: Truncation is usually wrong.  If you are on an
error path, look for some way to get a correct error return instead of
truncating.  In this case, it was trivial.  In some cases it isn't
(but remember - abort() is a usable error return, too), and truncation
is the only option - but don't reach for it as your first tool.

Eivind.

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



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