提交 6ae4f4a4 编写于 作者: J John Ferlan

util: Avoid possible error in virCommandMassClose

Avoid the chance that sysconf(_SC_OPEN_MAX) returns -1 and thus
would cause virBitmapNew would attempt to allocate a very large
bitmap.

Found by Coverity
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
ACKed-by: NPeter Krempa <pkrempa@redhat.com>
上级 73717ca0
......@@ -487,6 +487,11 @@ virCommandMassClose(virCommandPtr cmd,
* Therefore we can safely allocate memory here (and transitively call
* opendir/readdir) without a deadlock. */
if (openmax < 0) {
virReportSystemError(errno, "%s", _("sysconf(_SC_OPEN_MAX) failed"));
return -1;
}
if (!(fds = virBitmapNew(openmax)))
return -1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册