Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern make sure that we have enough space, don't require ...



details:   https://anonhg.NetBSD.org/src/rev/169eb345b7da
branches:  trunk
changeset: 358472:169eb345b7da
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 01 00:45:12 2018 +0000

description:
make sure that we have enough space, don't require the exact size
(Tom Ivar Helbekkmo)

diffstat:

 sys/kern/uipc_socket.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 36a95f488320 -r 169eb345b7da sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Sun Dec 31 19:39:57 2017 +0000
+++ b/sys/kern/uipc_socket.c    Mon Jan 01 00:45:12 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.257 2017/10/25 08:12:39 maya Exp $   */
+/*     $NetBSD: uipc_socket.c,v 1.258 2018/01/01 00:45:12 christos Exp $       */
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.257 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.258 2018/01/01 00:45:12 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2109,7 +2109,9 @@
                        return error;
        }
 
-       KASSERT(sopt->sopt_size == len);
+       if (sopt->sopt_size < len)
+               return EINVAL;
+       
        memcpy(sopt->sopt_data, buf, len);
        return 0;
 }
@@ -2169,7 +2171,9 @@
                        return error;
        }
 
-       KASSERT(sopt->sopt_size == len);
+       if (sopt->sopt_size < len)
+               return EINVAL;
+       
        m_copydata(m, 0, len, sopt->sopt_data);
        m_freem(m);
 



Home | Main Index | Thread Index | Old Index