summaryrefslogtreecommitdiff
path: root/src/rpc/virnetmessage.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-12-21 16:49:12 +0000
committerDaniel P. Berrange <berrange@redhat.com>2013-01-08 08:56:49 +0000
commit18937c3ae0990b4417a43aa07a2c35aaf8cb6ec2 (patch)
tree767e08642a4bf0bd63f27802b9414c6c51e4f64c /src/rpc/virnetmessage.c
parent24bcd8d45a8f15e478363185747a1391ecf59a83 (diff)
downloadlibvirt-18937c3ae0990b4417a43aa07a2c35aaf8cb6ec2.tar.gz
Fix receiving of file descriptors from server
A number of bugs handling file descriptors received from the server caused the FDs to be lost and leaked. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'src/rpc/virnetmessage.c')
-rw-r--r--src/rpc/virnetmessage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c
index b7330de593..647fef7be4 100644
--- a/src/rpc/virnetmessage.c
+++ b/src/rpc/virnetmessage.c
@@ -175,6 +175,12 @@ int virNetMessageDecodeHeader(virNetMessagePtr msg)
XDR xdr;
int ret = -1;
+ if (msg->bufferLength < VIR_NET_MESSAGE_LEN_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Unable to decode header until len is received"));
+ return -1;
+ }
+
msg->bufferOffset = VIR_NET_MESSAGE_LEN_MAX;
/* Parse the header. */