Date: Mon, 5 Mar 2001 07:10:05 -0800 (PST) From: Christophe Colle <colle@krtkg1.rug.ac.be> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/25543: pkg_info dumps core Message-ID: <200103051510.f25FA5q97594@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/25543; it has been noted by GNATS.
From: Christophe Colle <colle@krtkg1.rug.ac.be>
To: freebsd-gnats-submit@FreeBSD.org, colle@krtkg1.rug.ac.be
Cc:
Subject: Re: bin/25543: pkg_info dumps core
Date: Mon, 5 Mar 2001 16:05:09 +0100 (MET)
The core dump is due to accessing uninitialized memory:
pkg_perform(char **pkgs)
{
char **matched;
char *tmp;
int err_cnt = 0;
int i, errcode;
signal(SIGINT, cleanup);
/* Overriding action? */
if (CheckPkg) {
char buf[FILENAME_MAX];
snprintf(buf, FILENAME_MAX, "%s/%s", tmp, CheckPkg);
return abs(access(buf, R_OK));
/* Not reached */
}
the variable tmp is never initialised:
add the follwoing line:
tmp = getenv(PKG_DBDIR)?getenv(PKG_DBDIR):DEF_LOG_DIR;
so the code looks like:
pkg_perform(char **pkgs)
{
char **matched;
char *tmp;
int err_cnt = 0;
int i, errcode;
signal(SIGINT, cleanup);
/* Overriding action? */
if (CheckPkg) {
char buf[FILENAME_MAX];
tmp = getenv(PKG_DBDIR)?getenv(PKG_DBDIR):DEF_LOG_DIR;
snprintf(buf, FILENAME_MAX, "%s/%s", tmp, CheckPkg);
return abs(access(buf, R_OK));
/* Not reached */
}
Now it flies again....
Christophe Colle
| \ =============================================================
| \ Colle Christophe Phone: +32-(0)3-886.39.83
| \ mail: colle@krtkg1.rug.ac.be http://krtkg1.rug.ac.be/~colle
+-----
|
----------+ When I'm in Ghent, then I'm probably at Anouk's place..
\________| ======= Radiotherapy Department, Ghent =============
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200103051510.f25FA5q97594>
