提交 e0392f5a 编写于 作者: M Michal Privoznik

xen: Check return value of virStringReplace

After 6604a3dd in which new helper function has been
introduced, the code calls virStringReplace and dereference the
result immediately. The string function can, however, return NULL
so this would SIGSEGV right away. Check for the return value of
the string function.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 a0e5faaf
......@@ -254,7 +254,8 @@ xenParseXLDiskSrc(virDomainDiskDefPtr disk, char *srcstr)
int ret = -1;
if (STRPREFIX(srcstr, "rbd:")) {
tmpstr = virStringReplace(srcstr, "\\\\", "\\");
if (!(tmpstr = virStringReplace(srcstr, "\\\\", "\\")))
goto cleanup;
virDomainDiskSetType(disk, VIR_STORAGE_TYPE_NETWORK);
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_RBD;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册