提交 62a61d58 编写于 作者: P Peter Krempa

util: storage: Fix possible crash when source path is NULL

Some storage protocols allow to have the @path field in struct
virStorageSource set to NULL. Add NULLSTR() wrappers to handle this
possibility until I finish the storage source error formatter.
上级 64a9d2fa
...@@ -1391,20 +1391,21 @@ virStorageFileChainLookup(virStorageSourcePtr chain, ...@@ -1391,20 +1391,21 @@ virStorageFileChainLookup(virStorageSourcePtr chain,
if (idx) { if (idx) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("could not find backing store %u in chain for '%s'"), _("could not find backing store %u in chain for '%s'"),
idx, start); idx, NULLSTR(start));
} else if (name) { } else if (name) {
if (startFrom) if (startFrom)
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("could not find image '%s' beneath '%s' in " _("could not find image '%s' beneath '%s' in "
"chain for '%s'"), name, startFrom->path, start); "chain for '%s'"), name, NULLSTR(startFrom->path),
NULLSTR(start));
else else
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("could not find image '%s' in chain for '%s'"), _("could not find image '%s' in chain for '%s'"),
name, start); name, NULLSTR(start));
} else { } else {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("could not find base image in chain for '%s'"), _("could not find base image in chain for '%s'"),
start); NULLSTR(start));
} }
*parent = NULL; *parent = NULL;
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册