mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-23 21:35:26 +03:00
lib/core: Avoid NULL deref in content_file_parse() if out variable unset
Prep for a change in `ostree_repo_load_file()`. We would crash if a caller had `out_file_info = NULL`, because we deref `ret_file_info` below it. Closes: #951 Approved by: jlebon
This commit is contained in:
parent
90b587e2c8
commit
aafda9073a
@ -644,7 +644,7 @@ ostree_content_stream_parse (gboolean compressed,
|
||||
if (compressed)
|
||||
{
|
||||
if (!zlib_file_header_parse (file_header,
|
||||
out_file_info ? &ret_file_info : NULL,
|
||||
&ret_file_info,
|
||||
out_xattrs ? &ret_xattrs : NULL,
|
||||
error))
|
||||
return FALSE;
|
||||
@ -652,12 +652,11 @@ ostree_content_stream_parse (gboolean compressed,
|
||||
else
|
||||
{
|
||||
if (!file_header_parse (file_header,
|
||||
out_file_info ? &ret_file_info : NULL,
|
||||
&ret_file_info,
|
||||
out_xattrs ? &ret_xattrs : NULL,
|
||||
error))
|
||||
return FALSE;
|
||||
if (ret_file_info)
|
||||
g_file_info_set_size (ret_file_info, input_length - archive_header_size - 8);
|
||||
g_file_info_set_size (ret_file_info, input_length - archive_header_size - 8);
|
||||
}
|
||||
|
||||
g_autoptr(GInputStream) ret_input = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user