diff options
| author | 2019-07-16 17:39:02 +0000 | |
|---|---|---|
| committer | 2019-07-16 17:39:02 +0000 | |
| commit | 9392a7356dcbb9aa55ba792313ca7916e2904c2b (patch) | |
| tree | 0eeb34843cca395b3f239f3bf57262082a25e97d /sys/kern/kern_sysctl.c | |
| parent | 1) Re-resolve and re-get constraints once the clock is synced. Constraints (diff) | |
| download | wireguard-openbsd-9392a7356dcbb9aa55ba792313ca7916e2904c2b.tar.xz wireguard-openbsd-9392a7356dcbb9aa55ba792313ca7916e2904c2b.zip | |
Prevent integer overflow in kernel and userland when checking mbuf
limits. Convert kernel variables and calculations for mbuf memory
into long to allow larger values on 64 bit machines. Put a range
check into the kernel sysctl. For the interface itself int is still
sufficient. In netstat -m cast all multiplications to unsigned
long to hold the product of two unsigned int.
input and OK visa@
Diffstat (limited to 'sys/kern/kern_sysctl.c')
| -rw-r--r-- | sys/kern/kern_sysctl.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 1cdaf84f032..f3bef1a20c0 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.363 2019/07/12 13:56:27 solene Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.364 2019/07/16 17:39:02 bluhm Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -129,8 +129,6 @@ extern int audio_record_enable; int allowkmem; -extern void nmbclust_update(void); - int sysctl_diskinit(int, struct proc *); int sysctl_proc_args(int *, u_int, void *, size_t *, struct proc *); int sysctl_proc_cwd(int *, u_int, void *, size_t *, struct proc *); @@ -590,11 +588,13 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (sysctl_wdog(name + 1, namelen - 1, oldp, oldlenp, newp, newlen)); #endif - case KERN_MAXCLUSTERS: - error = sysctl_int(oldp, oldlenp, newp, newlen, &nmbclust); - if (!error) - nmbclust_update(); + case KERN_MAXCLUSTERS: { + int val = nmbclust; + error = sysctl_int(oldp, oldlenp, newp, newlen, &val); + if (error == 0 && val != nmbclust) + error = nmbclust_update(val); return (error); + } #ifndef SMALL_KERNEL case KERN_EVCOUNT: return (evcount_sysctl(name + 1, namelen - 1, oldp, oldlenp, |
