From: Jiri Denemark Date: Fri, 27 Jan 2012 10:14:21 +0000 (+0100) Subject: apparmor: Fix use of uninitialized random_data X-Git-Tag: v0.9.10-rc1~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc1edeb61182cd277d6f2fe5c50df2a2806d5e69;p=thirdparty%2Flibvirt.git apparmor: Fix use of uninitialized random_data Without this, virt-aa-helper would segfault in -c or -r commands. --- diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 4561bb9db4..b484a2029e 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -42,6 +42,7 @@ #include "pci.h" #include "virfile.h" #include "configmake.h" +#include "virrandom.h" #define VIR_FROM_THIS VIR_FROM_SECURITY @@ -1182,6 +1183,9 @@ main(int argc, char **argv) memset(ctl, 0, sizeof(vahControl)); + if (virRandomInitialize(time(NULL) ^ getpid()) < 0) + vah_error(ctl, 1, _("could not initialize random generator")); + if (vahParseArgv(ctl, argc, argv) != 0) vah_error(ctl, 1, _("could not parse arguments"));