diff /usr/src/usr.bin/ssh/buffer.c ssh/buffer.c --- /usr/src/usr.bin/ssh/buffer.c Tue Sep 16 14:31:43 2003 +++ ssh/buffer.c Tue Sep 16 23:05:02 2003 @@ -12,7 +12,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $"); +RCSID("$OpenBSD: buffer.c,v 1.18 2003/09/16 21:02:39 markus Exp $"); #include "xmalloc.h" #include "buffer.h" @@ -23,8 +23,11 @@ void buffer_init(Buffer *buffer) { - buffer->alloc = 4096; - buffer->buf = xmalloc(buffer->alloc); + const u_int len = 4096; + + buffer->alloc = 0; + buffer->buf = xmalloc(len); + buffer->alloc = len; buffer->offset = 0; buffer->end = 0; } @@ -34,8 +37,10 @@ void buffer_free(Buffer *buffer) { - memset(buffer->buf, 0, buffer->alloc); - xfree(buffer->buf); + if (buffer->alloc > 0) { + memset(buffer->buf, 0, buffer->alloc); + xfree(buffer->buf); + } } /* @@ -163,7 +168,7 @@ void buffer_dump(Buffer *buffer) { - int i; + u_int i; u_char *ucp = buffer->buf; for (i = buffer->offset; i < buffer->end; i++) { diff /usr/src/usr.bin/ssh/channels.c ssh/channels.c --- /usr/src/usr.bin/ssh/channels.c Fri Aug 29 12:04:14 2003 +++ ssh/channels.c Tue Sep 16 23:05:02 2003 @@ -39,7 +39,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.194 2003/08/29 10:04:36 markus Exp $"); +RCSID("$OpenBSD: channels.c,v 1.195 2003/09/16 21:02:40 markus Exp $"); #include "ssh.h" #include "ssh1.h" @@ -228,12 +228,13 @@ if (found == -1) { /* There are no free slots. Take last+1 slot and expand the array. */ found = channels_alloc; - channels_alloc += 10; if (channels_alloc > 10000) fatal("channel_new: internal error: channels_alloc %d " "too big.", channels_alloc); + channels = xrealloc(channels, + (channels_alloc + 10) * sizeof(Channel *)); + channels_alloc += 10; debug2("channel: expanding %d", channels_alloc); - channels = xrealloc(channels, channels_alloc * sizeof(Channel *)); for (i = found; i < channels_alloc; i++) channels[i] = NULL; } diff /usr/src/usr.bin/ssh/version.h ssh/version.h --- /usr/src/usr.bin/ssh/version.h Tue Sep 2 21:11:22 2003 +++ ssh/version.h Tue Sep 16 23:05:03 2003 @@ -1,3 +1,3 @@ -/* $OpenBSD: version.h,v 1.38 2003/09/02 16:40:29 markus Exp $ */ +/* $OpenBSD: version.h,v 1.39 2003/09/16 21:02:40 markus Exp $ */ -#define SSH_VERSION "OpenSSH_3.7" +#define SSH_VERSION "OpenSSH_3.7.1"