From owner-cvs-all Sat Apr 6 20:48: 4 2002
Delivered-To: cvs-all@freebsd.org
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
by hub.freebsd.org (Postfix) with ESMTP
id D620637B41C; Sat, 6 Apr 2002 20:47:58 -0800 (PST)
Received: (from dd@localhost)
by freefall.freebsd.org (8.11.6/8.11.6) id g374lwR75411;
Sat, 6 Apr 2002 20:47:58 -0800 (PST)
(envelope-from dd)
Message-Id: <200204070447.g374lwR75411@freefall.freebsd.org>
From: Dima Dorfman
Date: Sat, 6 Apr 2002 20:47:58 -0800 (PST)
To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject: cvs commit: src/lib/libkvm kvm_proc.c
X-FreeBSD-CVS-Branch: HEAD
Sender: owner-cvs-all@FreeBSD.ORG
Precedence: bulk
List-ID:
List-Archive: (Web Archive)
List-Help: (List Instructions)
List-Subscribe:
List-Unsubscribe:
X-Loop: FreeBSD.ORG
dd 2002/04/06 20:47:58 PST
Modified files:
lib/libkvm kvm_proc.c
Log:
Fix (for the second time) kvm_getprocs() for the case where no
processes match the given criteria. Since revision 1.60 of malloc.c,
malloc() and friends return an invalid pointer when given a size of 0.
kvm_getprocs() uses sysctl() with a NULL oldp argument to get an
initial size, but does not check whether it's 0 before passing it to
realloc() (via _kvm_realloc()). Before the aforementioned malloc()
change, this resulted in a minimal allocation made and a valid poitner
returned, but now results in an invalid, but non-NULL, pointer being
returned. When this is passed to sysctl(), the latter returns EFAULT
(as it should).
Revision Changes Path
1.46 +26 -0 src/lib/libkvm/kvm_proc.c
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message