mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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: John Ferlan <jferlan@redhat.com> ACKed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
73717ca074
commit
6ae4f4a4ce
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user