Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/net Pull up following revision(s) (requested by riast...
details: https://anonhg.NetBSD.org/src/rev/c7732ff528b3
branches: netbsd-9
changeset: 373632:c7732ff528b3
user: martin <martin%NetBSD.org@localhost>
date: Wed Feb 22 19:50:33 2023 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #1605):
sys/net/bpf.c: revision 1.247 (manually merged)
bpf(4): Reject bogus timeout values before arithmetic overflows.
diffstat:
sys/net/bpf.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diffs (54 lines):
diff -r 70205c5696ab -r c7732ff528b3 sys/net/bpf.c
--- a/sys/net/bpf.c Wed Feb 22 19:30:50 2023 +0000
+++ b/sys/net/bpf.c Wed Feb 22 19:50:33 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.229.2.1 2019/10/16 09:46:55 martin Exp $ */
+/* $NetBSD: bpf.c,v 1.229.2.2 2023/02/22 19:50:33 martin Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.229.2.1 2019/10/16 09:46:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.229.2.2 2023/02/22 19:50:33 martin Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -1092,7 +1092,16 @@
struct timeval *tv = addr;
/* Compute number of ticks. */
- d->bd_rtout = tv->tv_sec * hz + tv->tv_usec / tick;
+ if (tv->tv_sec < 0 ||
+ tv->tv_usec < 0 || tv->tv_usec >= 1000000) {
+ error = EINVAL;
+ break;
+ } else if (tv->tv_sec > INT_MAX/hz - 1) {
+ d->bd_rtout = INT_MAX;
+ } else {
+ d->bd_rtout = tv->tv_sec * hz
+ + tv->tv_usec / tick;
+ }
if ((d->bd_rtout == 0) && (tv->tv_usec != 0))
d->bd_rtout = 1;
break;
@@ -1121,7 +1130,16 @@
struct timeval50 *tv = addr;
/* Compute number of ticks. */
- d->bd_rtout = tv->tv_sec * hz + tv->tv_usec / tick;
+ if (tv->tv_sec < 0 ||
+ tv->tv_usec < 0 || tv->tv_usec >= 1000000) {
+ error = EINVAL;
+ break;
+ } else if (tv->tv_sec > INT_MAX/hz - 1) {
+ d->bd_rtout = INT_MAX;
+ } else {
+ d->bd_rtout = tv->tv_sec * hz
+ + tv->tv_usec / tick;
+ }
if ((d->bd_rtout == 0) && (tv->tv_usec != 0))
d->bd_rtout = 1;
break;
Home |
Main Index |
Thread Index |
Old Index