mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-09 01:18:35 +03:00
lib: Check for NULL pointers in some more places
In `write_metadata_object()`, make sure when creating tombstone commits that we're actually passed an expected checksum to use. In `write_dir_entry_to_mtree_internal()`, sanity check that `dfd_iter` is indeed not `NULL` before trying to dereference it. Discovered by Coverity. Closes: #1692 Approved by: cgwalters
This commit is contained in:
parent
799cfcb5b3
commit
9482922e5e
@ -1295,6 +1295,7 @@ write_metadata_object (OstreeRepo *self,
|
|||||||
char actual_checksum[OSTREE_SHA256_STRING_LEN+1];
|
char actual_checksum[OSTREE_SHA256_STRING_LEN+1];
|
||||||
if (is_tombstone)
|
if (is_tombstone)
|
||||||
{
|
{
|
||||||
|
g_assert (expected_checksum != NULL);
|
||||||
memcpy (actual_checksum, expected_checksum, sizeof (actual_checksum));
|
memcpy (actual_checksum, expected_checksum, sizeof (actual_checksum));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -3309,6 +3310,7 @@ write_dir_entry_to_mtree_internal (OstreeRepo *self,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
g_assert (dfd_iter != NULL);
|
||||||
g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, };
|
g_auto(GLnxDirFdIterator) child_dfd_iter = { 0, };
|
||||||
|
|
||||||
if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, name, FALSE, &child_dfd_iter, error))
|
if (!glnx_dirfd_iterator_init_at (dfd_iter->fd, name, FALSE, &child_dfd_iter, error))
|
||||||
|
Loading…
Reference in New Issue
Block a user