1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

virExec: avoid undefined behavior

* src/util/util.c (__virExec): Don't use FD_ISSET on out-of-bounds fd.
This commit is contained in:
Eric Blake 2010-12-03 15:02:01 -07:00
parent 044f2011aa
commit c3568ec289

View File

@ -570,8 +570,7 @@ __virExec(const char *const*argv,
i != null &&
i != childout &&
i != childerr &&
(!keepfd ||
!FD_ISSET(i, keepfd))) {
(!keepfd || (i < FD_SETSIZE && !FD_ISSET(i, keepfd)))) {
tmpfd = i;
VIR_FORCE_CLOSE(tmpfd);
}