diff options
author | Damien Miller <djm@mindrot.org> | 2003-09-17 07:31:14 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2003-09-17 07:31:14 +1000 |
commit | 5efcecc26525b58f699997697e6114fd83708733 (patch) | |
tree | 6b160851a0cda23287072125a1d030fa7d57b900 | |
parent | f2728099baa0fe4e6f1a8bfa321aefbf412f6543 (diff) |
- (djm) OpenBSD Sync
- markus@cvs.openbsd.org 2003/09/16 21:02:40
[buffer.c channels.c version.h]
more malloc/fatal fixes; ok millert/deraadt; ghudson at MIT.EDU
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | buffer.c | 15 | ||||
-rw-r--r-- | channels.c | 7 | ||||
-rw-r--r-- | version.h | 4 |
4 files changed, 21 insertions, 11 deletions
@@ -1,5 +1,9 @@ | |||
1 | 20030917 | 1 | 20030917 |
2 | - (djm) Sync with V_3_7 branch | 2 | - (djm) Sync with V_3_7 branch |
3 | - (djm) OpenBSD Sync | ||
4 | - markus@cvs.openbsd.org 2003/09/16 21:02:40 | ||
5 | [buffer.c channels.c version.h] | ||
6 | more malloc/fatal fixes; ok millert/deraadt; ghudson at MIT.EDU | ||
3 | 7 | ||
4 | 20030916 | 8 | 20030916 |
5 | - (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve | 9 | - (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve |
@@ -1108,4 +1112,4 @@ | |||
1108 | - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. | 1112 | - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. |
1109 | Report from murple@murple.net, diagnosis from dtucker@zip.com.au | 1113 | Report from murple@murple.net, diagnosis from dtucker@zip.com.au |
1110 | 1114 | ||
1111 | $Id: ChangeLog,v 1.2997 2003/09/16 21:24:25 djm Exp $ | 1115 | $Id: ChangeLog,v 1.2998 2003/09/16 21:31:14 djm Exp $ |
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $"); | 15 | RCSID("$OpenBSD: buffer.c,v 1.18 2003/09/16 21:02:39 markus Exp $"); |
16 | 16 | ||
17 | #include "xmalloc.h" | 17 | #include "xmalloc.h" |
18 | #include "buffer.h" | 18 | #include "buffer.h" |
@@ -23,8 +23,11 @@ RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $"); | |||
23 | void | 23 | void |
24 | buffer_init(Buffer *buffer) | 24 | buffer_init(Buffer *buffer) |
25 | { | 25 | { |
26 | buffer->alloc = 4096; | 26 | const u_int len = 4096; |
27 | buffer->buf = xmalloc(buffer->alloc); | 27 | |
28 | buffer->alloc = 0; | ||
29 | buffer->buf = xmalloc(len); | ||
30 | buffer->alloc = len; | ||
28 | buffer->offset = 0; | 31 | buffer->offset = 0; |
29 | buffer->end = 0; | 32 | buffer->end = 0; |
30 | } | 33 | } |
@@ -34,8 +37,10 @@ buffer_init(Buffer *buffer) | |||
34 | void | 37 | void |
35 | buffer_free(Buffer *buffer) | 38 | buffer_free(Buffer *buffer) |
36 | { | 39 | { |
37 | memset(buffer->buf, 0, buffer->alloc); | 40 | if (buffer->alloc > 0) { |
38 | xfree(buffer->buf); | 41 | memset(buffer->buf, 0, buffer->alloc); |
42 | xfree(buffer->buf); | ||
43 | } | ||
39 | } | 44 | } |
40 | 45 | ||
41 | /* | 46 | /* |
diff --git a/channels.c b/channels.c index 65a6a7f00..3d75c8f2b 100644 --- a/channels.c +++ b/channels.c | |||
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: channels.c,v 1.194 2003/08/29 10:04:36 markus Exp $"); | 42 | RCSID("$OpenBSD: channels.c,v 1.195 2003/09/16 21:02:40 markus Exp $"); |
43 | 43 | ||
44 | #include "ssh.h" | 44 | #include "ssh.h" |
45 | #include "ssh1.h" | 45 | #include "ssh1.h" |
@@ -229,12 +229,13 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, | |||
229 | if (found == -1) { | 229 | if (found == -1) { |
230 | /* There are no free slots. Take last+1 slot and expand the array. */ | 230 | /* There are no free slots. Take last+1 slot and expand the array. */ |
231 | found = channels_alloc; | 231 | found = channels_alloc; |
232 | channels_alloc += 10; | ||
233 | if (channels_alloc > 10000) | 232 | if (channels_alloc > 10000) |
234 | fatal("channel_new: internal error: channels_alloc %d " | 233 | fatal("channel_new: internal error: channels_alloc %d " |
235 | "too big.", channels_alloc); | 234 | "too big.", channels_alloc); |
235 | channels = xrealloc(channels, | ||
236 | (channels_alloc + 10) * sizeof(Channel *)); | ||
237 | channels_alloc += 10; | ||
236 | debug2("channel: expanding %d", channels_alloc); | 238 | debug2("channel: expanding %d", channels_alloc); |
237 | channels = xrealloc(channels, channels_alloc * sizeof(Channel *)); | ||
238 | for (i = found; i < channels_alloc; i++) | 239 | for (i = found; i < channels_alloc; i++) |
239 | channels[i] = NULL; | 240 | channels[i] = NULL; |
240 | } | 241 | } |
@@ -1,3 +1,3 @@ | |||
1 | /* $OpenBSD: version.h,v 1.37 2003/04/01 10:56:46 markus Exp $ */ | 1 | /* $OpenBSD: version.h,v 1.39 2003/09/16 21:02:40 markus Exp $ */ |
2 | 2 | ||
3 | #define SSH_VERSION "OpenSSH_3.7p1" | 3 | #define SSH_VERSION "OpenSSH_3.7.1p1" |