1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

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>
This commit is contained in:
Dan McGee 2011-06-24 01:33:12 -05:00
parent e27a5c8851
commit d589a7b5db

View File

@ -332,10 +332,8 @@ static int sync_db_populate(pmdb_t *db)
/* we have desc, depends or deltas - parse it */ /* we have desc, depends or deltas - parse it */
if(sync_db_read(db, archive, entry, pkg) != 0) { if(sync_db_read(db, archive, entry, pkg) != 0) {
_alpm_log(db->handle, PM_LOG_ERROR, _alpm_log(db->handle, PM_LOG_ERROR,
_("could not parse package '%s' description file from db '%s'\n"), _("could not parse package description file '%s' from db '%s'\n"),
pkg->name, db->treename); archive_entry_pathname(entry), db->treename);
_alpm_pkg_free(pkg);
pkg = NULL;
continue; continue;
} }
} }