From: Daniel P. Berrange Date: Thu, 19 Aug 2010 13:32:10 +0000 (+0100) Subject: Ensure remote daemon unions are always non-zero length X-Git-Tag: v0.8.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bdb05ea7c782d79634f4b7275af9e0b132caa18;p=thirdparty%2Flibvirt.git Ensure remote daemon unions are always non-zero length If the remote daemon args/ret unions ever become zero length (due to a build / Makefile bug) then bad stuff happens at runtime. Add a compile time assertion to check for this kind of problem * daemon/remote.h: Ensure non-zero length unions --- diff --git a/daemon/remote.h b/daemon/remote.h index fd8d3814a8..1eb83865cb 100644 --- a/daemon/remote.h +++ b/daemon/remote.h @@ -30,18 +30,22 @@ typedef union { # include "remote_dispatch_args.h" } dispatch_args; +verify(sizeof(dispatch_args) > 0); typedef union { # include "remote_dispatch_ret.h" } dispatch_ret; +verify(sizeof(dispatch_ret) > 0); typedef union { # include "qemu_dispatch_args.h" } qemu_dispatch_args; +verify(sizeof(qemu_dispatch_args) > 0); typedef union { # include "qemu_dispatch_ret.h" } qemu_dispatch_ret; +verify(sizeof(qemu_dispatch_ret) > 0);