lib/unpack.c: fix a NULL pointer deref when checking configuration

files exists or not while unpacking.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091010064437-9121w162sy8ilpim
This commit is contained in:
Juan RP 2009-10-10 08:44:37 +02:00
parent 5a26facf51
commit 53de9e531b

View File

@ -160,23 +160,25 @@ install_config_file(prop_dictionary_t d, struct archive_entry *entry,
forigd = prop_dictionary_internalize_from_file(buf);
free(buf);
if (forigd != NULL) {
if (forigd == NULL) {
install_new = true;
goto out;
}
iter2 = xbps_get_array_iter_from_dict(forigd, "conf_files");
if (iter2 != NULL) {
while ((obj2 = prop_object_iterator_next(iter2))) {
prop_dictionary_get_cstring_nocopy(obj2,
"file", &cffile);
if (strstr(archive_entry_pathname(entry),
cffile)) {
prop_dictionary_get_cstring(obj2,
"sha256", &sha256_orig);
if (strstr(archive_entry_pathname(entry), cffile)) {
prop_dictionary_get_cstring(obj2, "sha256",
&sha256_orig);
break;
}
}
prop_object_iterator_release(iter2);
}
prop_object_release(forigd);
}
/*
* Compare original, installed and new hash for current file.
@ -268,6 +270,7 @@ install_config_file(prop_dictionary_t d, struct archive_entry *entry,
}
}
out:
if (install_new)
set_extract_flags(flags);
if (sha256_orig)