summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mooney <pmooney@pfmooney.com>2016-05-21 02:16:27 +0000
committerPatrick Mooney <pmooney@pfmooney.com>2016-05-25 15:28:44 +0000
commit430df2d8b04c918ae55249a677210a90ba43b9d4 (patch)
treeea9ddb93446593ecfbc7af28f773d11770e2f90d
parent7c1ae48ce8fd1370223f751733eafa32aa8dd2f0 (diff)
downloadillumos-joyent-430df2d8b04c918ae55249a677210a90ba43b9d4.tar.gz
OS-5428 lxbrand setsockopt(IP_MULTICAST_TTL) handles optlen poorly
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_socket.c b/usr/src/uts/common/brand/lx/syscall/lx_socket.c
index e363a865aa..c8001add4f 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_socket.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_socket.c
@@ -3246,6 +3246,13 @@ lx_setsockopt(int sock, int level, int optname, void *optval, socklen_t optlen)
if (optlen > sizeof (stkbuf)) {
buflen = optlen;
optbuf = kmem_alloc(optlen, KM_SLEEP);
+ } else {
+ /*
+ * Zero the on-stack buffer to avoid poisoning smaller
+ * optvals with stack garbage.
+ */
+ stkbuf[0] = 0;
+ stkbuf[1] = 0;
}
if (copyin(optval, optbuf, optlen) != 0) {
if (buflen != 0) {