mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
- (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
This commit is contained in:
parent
f2728099ba
commit
5efcecc265
@ -1,5 +1,9 @@
|
|||||||
20030917
|
20030917
|
||||||
- (djm) Sync with V_3_7 branch
|
- (djm) Sync with V_3_7 branch
|
||||||
|
- (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
|
||||||
|
|
||||||
20030916
|
20030916
|
||||||
- (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve
|
- (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve
|
||||||
@ -1108,4 +1112,4 @@
|
|||||||
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
|
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
|
||||||
Report from murple@murple.net, diagnosis from dtucker@zip.com.au
|
Report from murple@murple.net, diagnosis from dtucker@zip.com.au
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.2997 2003/09/16 21:24:25 djm Exp $
|
$Id: ChangeLog,v 1.2998 2003/09/16 21:31:14 djm Exp $
|
||||||
|
15
buffer.c
15
buffer.c
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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 "xmalloc.h"
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
@ -23,8 +23,11 @@ RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $");
|
|||||||
void
|
void
|
||||||
buffer_init(Buffer *buffer)
|
buffer_init(Buffer *buffer)
|
||||||
{
|
{
|
||||||
buffer->alloc = 4096;
|
const u_int len = 4096;
|
||||||
buffer->buf = xmalloc(buffer->alloc);
|
|
||||||
|
buffer->alloc = 0;
|
||||||
|
buffer->buf = xmalloc(len);
|
||||||
|
buffer->alloc = len;
|
||||||
buffer->offset = 0;
|
buffer->offset = 0;
|
||||||
buffer->end = 0;
|
buffer->end = 0;
|
||||||
}
|
}
|
||||||
@ -34,8 +37,10 @@ buffer_init(Buffer *buffer)
|
|||||||
void
|
void
|
||||||
buffer_free(Buffer *buffer)
|
buffer_free(Buffer *buffer)
|
||||||
{
|
{
|
||||||
memset(buffer->buf, 0, buffer->alloc);
|
if (buffer->alloc > 0) {
|
||||||
xfree(buffer->buf);
|
memset(buffer->buf, 0, buffer->alloc);
|
||||||
|
xfree(buffer->buf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#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 "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
@ -229,12 +229,13 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
|||||||
if (found == -1) {
|
if (found == -1) {
|
||||||
/* There are no free slots. Take last+1 slot and expand the array. */
|
/* There are no free slots. Take last+1 slot and expand the array. */
|
||||||
found = channels_alloc;
|
found = channels_alloc;
|
||||||
channels_alloc += 10;
|
|
||||||
if (channels_alloc > 10000)
|
if (channels_alloc > 10000)
|
||||||
fatal("channel_new: internal error: channels_alloc %d "
|
fatal("channel_new: internal error: channels_alloc %d "
|
||||||
"too big.", channels_alloc);
|
"too big.", channels_alloc);
|
||||||
|
channels = xrealloc(channels,
|
||||||
|
(channels_alloc + 10) * sizeof(Channel *));
|
||||||
|
channels_alloc += 10;
|
||||||
debug2("channel: expanding %d", channels_alloc);
|
debug2("channel: expanding %d", channels_alloc);
|
||||||
channels = xrealloc(channels, channels_alloc * sizeof(Channel *));
|
|
||||||
for (i = found; i < channels_alloc; i++)
|
for (i = found; i < channels_alloc; i++)
|
||||||
channels[i] = NULL;
|
channels[i] = NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user