Skip to content

Commit

Permalink
OS-3825 lxbrand rsyslogd abort on centos6
Browse files Browse the repository at this point in the history
  • Loading branch information
bcantrill committed Mar 14, 2015
1 parent 9980ec4 commit e3ca935
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions usr/src/lib/brand/lx/lx_brand/common/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <netinet/icmp6.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <sys/lx_debug.h>
#include <sys/lx_syscall.h>
#include <sys/lx_socket.h>
Expand Down Expand Up @@ -2228,7 +2229,7 @@ lx_recvmsg(int sockfd, void *lmp, int flags)
struct cmsghdr *cmsg = NULL;
void *new_cmsg = NULL;
int r, err;
socklen_t len, orig_len = 0;
socklen_t len, orig_len = 0, controllen = 0;
void *msg_control = NULL;

int nosigpipe = flags & LX_MSG_NOSIGNAL;
Expand Down Expand Up @@ -2269,7 +2270,7 @@ lx_recvmsg(int sockfd, void *lmp, int flags)
*/
if (msg.msg_control != NULL) {
cmsg = msg.msg_control;
if (msg.msg_controllen == 0) {
if ((controllen = msg.msg_controllen) == 0) {
msg.msg_control = NULL;
} else {
/*
Expand Down Expand Up @@ -2335,8 +2336,8 @@ lx_recvmsg(int sockfd, void *lmp, int flags)
return (-err);
}

if ((uucopy(msg.msg_control, cmsg,
msg.msg_controllen)) != 0) {
if (uucopy(msg.msg_control, cmsg,
MIN(controllen, msg.msg_controllen)) != 0) {
free(msg_control);
free(new_cmsg);
return (-errno);
Expand Down

0 comments on commit e3ca935

Please sign in to comment.