summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-12-19 10:52:50 +1100
committerDamien Miller <djm@mindrot.org>2011-12-19 10:52:50 +1100
commit8ed4de8f1dcebddd7edc0dd3c10f1cb947d831eb (patch)
tree3c9442e4dfcae3662f42cb53cccc7e45f98c0897
parent913ddff40d090751d50be2339cd859505b24f65b (diff)
- djm@cvs.openbsd.org 2011/12/07 05:44:38
[auth2.c dh.c packet.c roaming.h roaming_client.c roaming_common.c] fix some harmless and/or unreachable int overflows; reported Xi Wang, ok markus@
-rw-r--r--ChangeLog4
-rw-r--r--auth2.c4
-rw-r--r--dh.c4
-rw-r--r--packet.c4
-rw-r--r--roaming.h7
-rw-r--r--roaming_client.c4
-rw-r--r--roaming_common.c4
7 files changed, 20 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f0471d70..a06554857 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,10 @@
17 > fix bz#1948: ssh -f doesn't fork for multiplexed connection. 17 > fix bz#1948: ssh -f doesn't fork for multiplexed connection.
18 > ok dtucker@ 18 > ok dtucker@
19 it interacts badly with ControlPersist 19 it interacts badly with ControlPersist
20 - djm@cvs.openbsd.org 2011/12/07 05:44:38
21 [auth2.c dh.c packet.c roaming.h roaming_client.c roaming_common.c]
22 fix some harmless and/or unreachable int overflows;
23 reported Xi Wang, ok markus@
20 24
2120111125 2520111125
22 - OpenBSD CVS Sync 26 - OpenBSD CVS Sync
diff --git a/auth2.c b/auth2.c
index c06c95f06..b66bef64c 100644
--- a/auth2.c
+++ b/auth2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2.c,v 1.123 2011/03/10 02:52:57 djm Exp $ */ 1/* $OpenBSD: auth2.c,v 1.124 2011/12/07 05:44:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -113,7 +113,7 @@ auth2_read_banner(void)
113 close(fd); 113 close(fd);
114 return (NULL); 114 return (NULL);
115 } 115 }
116 if (st.st_size > 1*1024*1024) { 116 if (st.st_size <= 0 || st.st_size > 1*1024*1024) {
117 close(fd); 117 close(fd);
118 return (NULL); 118 return (NULL);
119 } 119 }
diff --git a/dh.c b/dh.c
index b9029d867..d943ca1e1 100644
--- a/dh.c
+++ b/dh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.c,v 1.48 2009/10/01 11:37:33 grunk Exp $ */ 1/* $OpenBSD: dh.c,v 1.49 2011/12/07 05:44:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * 4 *
@@ -236,6 +236,8 @@ dh_gen_key(DH *dh, int need)
236{ 236{
237 int i, bits_set, tries = 0; 237 int i, bits_set, tries = 0;
238 238
239 if (need < 0)
240 fatal("dh_gen_key: need < 0");
239 if (dh->p == NULL) 241 if (dh->p == NULL)
240 fatal("dh_gen_key: dh->p == NULL"); 242 fatal("dh_gen_key: dh->p == NULL");
241 if (need > INT_MAX / 2 || 2 * need >= BN_num_bits(dh->p)) 243 if (need > INT_MAX / 2 || 2 * need >= BN_num_bits(dh->p))
diff --git a/packet.c b/packet.c
index ba9341731..5e82fe753 100644
--- a/packet.c
+++ b/packet.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: packet.c,v 1.173 2011/05/06 21:14:05 djm Exp $ */ 1/* $OpenBSD: packet.c,v 1.174 2011/12/07 05:44:38 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -242,7 +242,7 @@ packet_set_connection(int fd_in, int fd_out)
242void 242void
243packet_set_timeout(int timeout, int count) 243packet_set_timeout(int timeout, int count)
244{ 244{
245 if (timeout == 0 || count == 0) { 245 if (timeout <= 0 || count <= 0) {
246 active_state->packet_timeout_ms = -1; 246 active_state->packet_timeout_ms = -1;
247 return; 247 return;
248 } 248 }
diff --git a/roaming.h b/roaming.h
index 6bb94cc39..da069f878 100644
--- a/roaming.h
+++ b/roaming.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: roaming.h,v 1.5 2009/10/24 11:11:58 andreas Exp $ */ 1/* $OpenBSD: roaming.h,v 1.6 2011/12/07 05:44:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2004-2009 AppGate Network Security AB 3 * Copyright (c) 2004-2009 AppGate Network Security AB
4 * 4 *
@@ -18,8 +18,9 @@
18#ifndef ROAMING_H 18#ifndef ROAMING_H
19#define ROAMING_H 19#define ROAMING_H
20 20
21#define DEFAULT_ROAMBUF 65536 21#define DEFAULT_ROAMBUF 65536
22#define ROAMING_REQUEST "roaming@appgate.com" 22#define MAX_ROAMBUF (2*1024*1024) /* XXX arbitrary */
23#define ROAMING_REQUEST "roaming@appgate.com"
23 24
24extern int roaming_enabled; 25extern int roaming_enabled;
25extern int resume_in_progress; 26extern int resume_in_progress;
diff --git a/roaming_client.c b/roaming_client.c
index cea8e7360..48009d781 100644
--- a/roaming_client.c
+++ b/roaming_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: roaming_client.c,v 1.3 2010/01/18 01:50:27 dtucker Exp $ */ 1/* $OpenBSD: roaming_client.c,v 1.4 2011/12/07 05:44:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2004-2009 AppGate Network Security AB 3 * Copyright (c) 2004-2009 AppGate Network Security AB
4 * 4 *
@@ -72,7 +72,7 @@ roaming_reply(int type, u_int32_t seq, void *ctxt)
72 cookie = packet_get_int64(); 72 cookie = packet_get_int64();
73 key1 = oldkey1 = packet_get_int64(); 73 key1 = oldkey1 = packet_get_int64();
74 key2 = oldkey2 = packet_get_int64(); 74 key2 = oldkey2 = packet_get_int64();
75 set_out_buffer_size(packet_get_int() + get_snd_buf_size()); 75 set_out_buffer_size(packet_get_int() + get_snd_buf_size());
76 roaming_enabled = 1; 76 roaming_enabled = 1;
77} 77}
78 78
diff --git a/roaming_common.c b/roaming_common.c
index 9adbe56fc..8d0b6054a 100644
--- a/roaming_common.c
+++ b/roaming_common.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: roaming_common.c,v 1.8 2010/01/12 00:59:29 djm Exp $ */ 1/* $OpenBSD: roaming_common.c,v 1.9 2011/12/07 05:44:38 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2004-2009 AppGate Network Security AB 3 * Copyright (c) 2004-2009 AppGate Network Security AB
4 * 4 *
@@ -75,6 +75,8 @@ get_recv_buf_size()
75void 75void
76set_out_buffer_size(size_t size) 76set_out_buffer_size(size_t size)
77{ 77{
78 if (size == 0 || size > MAX_ROAMBUF)
79 fatal("%s: bad buffer size %lu", __func__, (u_long)size);
78 /* 80 /*
79 * The buffer size can only be set once and the buffer will live 81 * The buffer size can only be set once and the buffer will live
80 * as long as the session lives. 82 * as long as the session lives.