| Summary: | pkg_info dumps core | ||
|---|---|---|---|
| Product: | Base System | Reporter: | colle <colle> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
colle
2001-03-05 14:40:01 UTC
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 =============
This has been fixed. Revision 1.36 of perform.c puts these lines back in, so this pr should be closed. -- garrett rooney Unix was not designed to stop you from rooneg@electricjellyfish.net doing stupid things, because that would http://electricjellyfish.net/ stop you from doing clever things. State Changed From-To: open->closed Problem resolved |