From 6dbde03086ba9e807c72d6954cfbfe04552e6618 Mon Sep 17 00:00:00 2001 From: Randall Stewart Date: Wed, 24 Jan 2007 12:59:56 +0000 Subject: [PATCH] Fixes the MSG_PEEK for sctp_generic_recvmsg() the msg_flags were not being copied in properly so PEEK and any other msg_flags input operation were not being performed right. Approved by: gnn --- sys/kern/uipc_syscalls.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 136cc12dcdf8..e664e733717c 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -2648,7 +2648,7 @@ sctp_generic_recvmsg(td, uap) struct file *fp; struct sockaddr *fromsa; int fromlen; - int len, i, msg_flags = 0; + int len, i, msg_flags; int error = 0; #ifdef KTRACE struct uio *ktruio = NULL; @@ -2682,7 +2682,14 @@ sctp_generic_recvmsg(td, uap) } else { fromlen = 0; } - + if(uap->msg_flags) { + error = copyin(uap->msg_flags, &msg_flags, sizeof (int)); + if (error) { + goto out; + } + } else { + msg_flags = 0; + } auio.uio_iov = iov; auio.uio_iovcnt = uap->iovlen; auio.uio_segflg = UIO_USERSPACE; @@ -2699,6 +2706,7 @@ sctp_generic_recvmsg(td, uap) } len = auio.uio_resid; fromsa = (struct sockaddr *)sockbufstore; + #ifdef KTRACE if (KTRPOINT(td, KTR_GENIO)) ktruio = cloneuio(&auio);