Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Hum. Fix NULL deref triggerable with just write(0).
details: https://anonhg.NetBSD.org/src/rev/e3bb3f81873c
branches: trunk
changeset: 935063:e3bb3f81873c
user: maxv <maxv%NetBSD.org@localhost>
date: Tue Jun 23 18:30:17 2020 +0000
description:
Hum. Fix NULL deref triggerable with just write(0).
Reported-by: syzbot+45b31355bf880e175b73%syzkaller.appspotmail.com@localhost
diffstat:
sys/net/if_tun.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r 2d34876135c3 -r e3bb3f81873c sys/net/if_tun.c
--- a/sys/net/if_tun.c Tue Jun 23 17:21:55 2020 +0000
+++ b/sys/net/if_tun.c Tue Jun 23 18:30:17 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tun.c,v 1.158 2020/01/29 04:34:10 thorpej Exp $ */
+/* $NetBSD: if_tun.c,v 1.159 2020/06/23 18:30:17 maxv Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.158 2020/01/29 04:34:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.159 2020/06/23 18:30:17 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -857,6 +857,9 @@
TUNDEBUG("%s: tunwrite\n", ifp->if_xname);
+ if (uio->uio_resid == 0)
+ return 0;
+
if (tp->tun_flags & TUN_PREPADDR) {
if (uio->uio_resid < sizeof(dst)) {
error = EIO;
Home |
Main Index |
Thread Index |
Old Index