The segfault would have happened when a message was receieved on this socket 
without an associated fd being sent. This is bad behaviour on the part of the 
client, but shouldn't cause a segfault. This patch fixes the segfault, but 
we'll need to fix the client too!

Signed-off-by: Jon Ludlam <[email protected]


 stdext/unixext_stubs.c |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


# HG changeset patch
# User Jonathan Ludlam <[email protected]>
# Date 1267181730 0
# Node ID 148df13bcee2161cc869eb082e6a66721da34750
# Parent  45b22c29867df47adc2dc21a008c6f6730e6e4fc
CA-38105: Fix segfault in fork-and-exec-daemon.

The segfault would have happened when a message was receieved on this socket without an associated fd being sent. This is bad behaviour on the part of the client, but shouldn't cause a segfault. This patch fixes the segfault, but we'll need to fix the client too!

Signed-off-by: Jon Ludlam <[email protected]

diff -r 45b22c29867d -r 148df13bcee2 stdext/unixext_stubs.c
--- a/stdext/unixext_stubs.c	Wed Feb 17 10:14:40 2010 +0000
+++ b/stdext/unixext_stubs.c	Fri Feb 26 10:55:30 2010 +0000
@@ -384,7 +384,7 @@
   if(ret == -1) 
     unixext_error(errno);
 
-  if(ret> 0) {
+  if(ret>0 && msg.msg_controllen>0) {
     cmsg = CMSG_FIRSTHDR(&msg);
     if(cmsg->cmsg_level == SOL_SOCKET && (cmsg->cmsg_type == SCM_RIGHTS)) {
       fd=Val_int(*(int*)CMSG_DATA(cmsg));
_______________________________________________
xen-api mailing list
[email protected]
http://lists.xensource.com/mailman/listinfo/xen-api

Reply via email to