mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
launch: direct: check for null paths in make_uri
Some protocols may pass a null path to make_uri, so make sure to handle that gracefully.
This commit is contained in:
@@ -1218,7 +1218,7 @@ make_uri (guestfs_h *g, const char *scheme, const char *user,
|
||||
CLEANUP_FREE char *userauth = NULL;
|
||||
|
||||
/* Need to add a leading '/' to URI paths since xmlSaveUri doesn't. */
|
||||
if (path[0] != '/') {
|
||||
if (path != NULL && path[0] != '/') {
|
||||
pathslash = safe_asprintf (g, "/%s", path);
|
||||
uri.path = pathslash;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user