summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_socket2.c
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2001-05-02 08:33:50 +0000
committerNiels Provos <provos@cvs.openbsd.org>2001-05-02 08:33:50 +0000
commit4317531d8744ef2a23f1bcd40a781fc906f0631f (patch)
tree8e3ec2e8735c417a900c99fd3c90fe0455b2b0fe /sys/kern/uipc_socket2.c
parent9088d868e4a125e39183068c20cb51647f3fc9c2 (diff)
prevent overflow in sbreserve; from wollman@freebsd via netbsd
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r--sys/kern/uipc_socket2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index 68cb8c9eca2..1f30c4a8ded 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.15 2000/11/16 20:02:19 provos Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.16 2001/05/02 08:33:49 provos Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -394,7 +394,8 @@ sbreserve(sb, cc)
u_long cc;
{
- if (cc == 0 || cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES))
+ if (cc == 0 ||
+ (u_int64_t)cc > (u_int64_t)sb_max * MCLBYTES / (MSIZE + MCLBYTES))
return (0);
sb->sb_hiwat = cc;
sb->sb_mbmax = min(cc * 2, sb_max);