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:
parent
5a26facf51
commit
53de9e531b
35
lib/unpack.c
35
lib/unpack.c
@ -160,24 +160,26 @@ install_config_file(prop_dictionary_t d, struct archive_entry *entry,
|
||||
|
||||
forigd = prop_dictionary_internalize_from_file(buf);
|
||||
free(buf);
|
||||
if (forigd != NULL) {
|
||||
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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
prop_object_iterator_release(iter2);
|
||||
}
|
||||
prop_object_release(forigd);
|
||||
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);
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user