Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb usbnet: Reject buflen>MCLBYTES in usbnet_newbuf.



details:   https://anonhg.NetBSD.org/src/rev/08241194b3be
branches:  trunk
changeset: 943209:08241194b3be
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Aug 28 17:05:32 2020 +0000

description:
usbnet: Reject buflen>MCLBYTES in usbnet_newbuf.

diffstat:

 sys/dev/usb/usbnet.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r 231e5073f54c -r 08241194b3be sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Fri Aug 28 17:01:48 2020 +0000
+++ b/sys/dev/usb/usbnet.c      Fri Aug 28 17:05:32 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.38 2020/03/15 23:04:51 thorpej Exp $      */
+/*     $NetBSD: usbnet.c,v 1.39 2020/08/28 17:05:32 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.38 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.39 2020/08/28 17:05:32 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -239,6 +239,9 @@
 {
        struct mbuf *m;
 
+       if (buflen > MCLBYTES)
+               return NULL;
+
        MGETHDR(m, M_DONTWAIT, MT_DATA);
        if (m == NULL)
                return NULL;



Home | Main Index | Thread Index | Old Index