From 5e838e04e3b91d8abb280148ff38b52013f10389 Mon Sep 17 00:00:00 2001 From: glebius Date: Tue, 17 May 2016 22:28:53 +0000 Subject: [PATCH] Validate that user supplied control message length is not negative. Submitted by: C Turt Security: SA-16:19 Security: CVE-2016-1887 --- sys/kern/uipc_syscalls.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 05703ef65c155c..7184e47ba62ad1 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1699,6 +1699,9 @@ sockargs(mp, buf, buflen, type) struct mbuf *m; int error; + if (buflen < 0) + return (EINVAL); + if (buflen > MLEN) { #ifdef COMPAT_OLDSOCK if (type == MT_SONAME && buflen <= 112)