Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Bounds checking - CID/1428650
details: https://anonhg.NetBSD.org/src/rev/477c2062bfe2
branches: trunk
changeset: 359047:477c2062bfe2
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Fri Jan 26 22:54:33 2018 +0000
description:
Bounds checking - CID/1428650
diffstat:
sys/kern/kern_sysctl.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 00b8a1ecff23 -r 477c2062bfe2 sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c Fri Jan 26 22:48:22 2018 +0000
+++ b/sys/kern/kern_sysctl.c Fri Jan 26 22:54:33 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_sysctl.c,v 1.259 2017/04/25 22:07:10 pgoyette Exp $ */
+/* $NetBSD: kern_sysctl.c,v 1.260 2018/01/26 22:54:33 pgoyette Exp $ */
/*-
* Copyright (c) 2003, 2007, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.259 2017/04/25 22:07:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.260 2018/01/26 22:54:33 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_defcorename.h"
@@ -2415,6 +2415,8 @@
const struct sysctlnode *pnode;
struct sysctllog *log;
+ KASSERT(namelen < CTL_MAXNAME);
+
if (node->sysctl_flags & CTLFLAG_PERMANENT)
return (0);
@@ -2476,7 +2478,7 @@
* stuff name in, then namelen, then node type, and finally,
* the version for non-node nodes.
*/
- for (i = 0; i < namelen; i++)
+ for (i = 0; i < namelen && i < CTL_MAXNAME; i++)
log->log_num[--log->log_left] = name[i];
log->log_num[--log->log_left] = namelen;
log->log_num[--log->log_left] = SYSCTL_TYPE(node->sysctl_flags);
Home |
Main Index |
Thread Index |
Old Index