Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb avoid potential NULL deref in failure case



details:   https://anonhg.NetBSD.org/src/rev/be6a8c93bfb4
branches:  trunk
changeset: 342795:be6a8c93bfb4
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sat Jan 09 03:33:53 2016 +0000

description:
avoid potential NULL deref in failure case

diffstat:

 sys/dev/usb/hid.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 25286ee6ff4b -r be6a8c93bfb4 sys/dev/usb/hid.c
--- a/sys/dev/usb/hid.c Sat Jan 09 02:06:22 2016 +0000
+++ b/sys/dev/usb/hid.c Sat Jan 09 03:33:53 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hid.c,v 1.40 2016/01/07 16:10:49 jakllsch Exp $        */
+/*     $NetBSD: hid.c,v 1.41 2016/01/09 03:33:53 jakllsch Exp $        */
 /*     $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.40 2016/01/07 16:10:49 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.41 2016/01/09 03:33:53 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -425,7 +425,8 @@
                }
        }
        hid_end_parse(d);
-       loc->size = 0;
+       if (loc != NULL)
+               loc->size = 0;
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index