lib/util: Fix segfault when validating filename

This change fixes the segfault issue when calling ostree_repo_checkout_tree with
empty GFileInfo. A simple condition check for NULL value is added at
src/libotutil/ot-unix-utils.c:46. Closes: ostreedev#1864.

Closes: #1868
Approved by: jlebon
This commit is contained in:
Allen Bai 2019-06-05 10:30:31 -04:00 committed by Atomic Bot
parent e0ddaa811b
commit 6733843f87

View File

@ -43,6 +43,8 @@ gboolean
ot_util_filename_validate (const char *name,
GError **error)
{
if (name == NULL)
return glnx_throw (error, "Invalid NULL filename");
if (strcmp (name, ".") == 0)
return glnx_throw (error, "Invalid self-referential filename '.'");
if (strcmp (name, "..") == 0)