[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] virExec: avoid uninitialized memory usage



valgrind warns:

==21079== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==21079==    at 0x329840F63E: __libc_sigaction (sigaction.c:67)
==21079==    by 0x4E5A8E7: __virExec (util.c:661)

Regression introduced in commit ab07533e.  Technically, sa_mask
shouldn't affect operation if sa_flags selects sa_handler, and
sa_handler selects SIG_IGN, but better safe than sorry.

* src/util/util.c (__virExec): Supply missing sigemptyset.
---
 src/util/util.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index 965e96d..9bd7015 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -657,6 +657,7 @@ __virExec(const char *const*argv,
         struct sigaction waxon, waxoff;
         waxoff.sa_handler = SIG_IGN;
         waxoff.sa_flags = 0;
+        sigemptyset(&waxoff.sa_mask);
         memset(&waxon, 0, sizeof(waxon));
         if (sigaction(SIGPIPE, &waxoff, &waxon) < 0) {
             virReportSystemError(errno, "%s",
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]