summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-24 01:33:12 -0500
committerDan McGee <dan@archlinux.org>2011-06-24 01:36:47 -0500
commitd589a7b5dbdfcf740d72aa4e9e8fcab9a3de0fbd (patch)
tree2ffab5bab55ff3e9ce54227e2d49eaaaa7048692
parente27a5c88514c5eb9480294374e98914ec27bf65d (diff)
downloadpacman-d589a7b5dbdfcf740d72aa4e9e8fcab9a3de0fbd.tar.xz
Prevent segfault when parsing unexpected sync database file
This doesn't fix the real (bigger) problem of failing to parse sync databases without directory entries, but it does prevent the parser from segfaulting when the first desc file encountered did not have a directory entry, among other conditions. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/be_sync.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index f0b1736d..e5fc6a70 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -332,10 +332,8 @@ static int sync_db_populate(pmdb_t *db)
/* we have desc, depends or deltas - parse it */
if(sync_db_read(db, archive, entry, pkg) != 0) {
_alpm_log(db->handle, PM_LOG_ERROR,
- _("could not parse package '%s' description file from db '%s'\n"),
- pkg->name, db->treename);
- _alpm_pkg_free(pkg);
- pkg = NULL;
+ _("could not parse package description file '%s' from db '%s'\n"),
+ archive_entry_pathname(entry), db->treename);
continue;
}
}