提交 85ccf42c 编写于 作者: O Osier Yang 提交者: Eric Blake

util: Fix bug which will cause libvirtd crash

"virCommandRun": if "cmd->outbuf" or "cmd->errbuf" is NULL,
libvirtd will be crashed when trying to start a qemu domain
(which invokes "virCommandRun"), it caused by we try to use
"*cmd->outbuf" and "*cmd->errbuf" regardless of cmd->outbuf
or cmd->errbuf is NULL.

* src/util/command.c (virCommandRun)
上级 58d0f4d7
...@@ -931,8 +931,8 @@ virCommandRun(virCommandPtr cmd, int *exitstatus) ...@@ -931,8 +931,8 @@ virCommandRun(virCommandPtr cmd, int *exitstatus)
ret = -1; ret = -1;
VIR_DEBUG("Result stdout: '%s' stderr: '%s'", VIR_DEBUG("Result stdout: '%s' stderr: '%s'",
NULLSTR(*cmd->outbuf), cmd->outbuf ? NULLSTR(*cmd->outbuf) : "(null)",
NULLSTR(*cmd->errbuf)); cmd->errbuf ? NULLSTR(*cmd->errbuf) : "(null)");
/* Reset any capturing, in case caller runs /* Reset any capturing, in case caller runs
* this identical command again */ * this identical command again */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册