Source-Changes-HG archive

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

[src/trunk]: src/sys/net Error out if the type is beyond the storage size. No...



details:   https://anonhg.NetBSD.org/src/rev/282285ab11ea
branches:  trunk
changeset: 455326:282285ab11ea
user:      maxv <maxv%NetBSD.org@localhost>
date:      Mon Oct 14 16:43:04 2019 +0000

description:
Error out if the type is beyond the storage size. No functional change,
since the shift would otherwise 'and' against zero, returning EEXIST.

Reported-by: syzbot+cb68ccdc1ef3aca2d679%syzkaller.appspotmail.com@localhost

diffstat:

 sys/net/rtsock_shared.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r c3e19c2399fa -r 282285ab11ea sys/net/rtsock_shared.c
--- a/sys/net/rtsock_shared.c   Mon Oct 14 16:27:03 2019 +0000
+++ b/sys/net/rtsock_shared.c   Mon Oct 14 16:43:04 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock_shared.c,v 1.10 2019/08/19 03:23:30 ozaki-r Exp $       */
+/*     $NetBSD: rtsock_shared.c,v 1.11 2019/10/14 16:43:04 maxv Exp $  */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.10 2019/08/19 03:23:30 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.11 2019/10/14 16:43:04 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -227,6 +227,8 @@
                return EINVAL;
 
        rtm = mtod(m, struct rt_xmsghdr *);
+       if (rtm->rtm_type >= sizeof(rop->rocb_msgfilter) * CHAR_BIT)
+               return EINVAL;
        /* If the rtm type is filtered out, return a positive. */
        if (!(rop->rocb_msgfilter & RTMSGFILTER(rtm->rtm_type)))
                return EEXIST;



Home | Main Index | Thread Index | Old Index