diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2003-09-16 03:31:03 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2003-09-16 03:31:03 +0000 |
commit | f2b4e4e07e7e2eae064d8e9f54f86f32a297bade (patch) | |
tree | 116fdf8688cb1977a4899f5a4f4ca5994fb1332b | |
parent | 16eec18a090fa22147605c5482d6e777a7ce85b5 (diff) |
- deraadt@cvs.openbsd.org 2003/09/16 03:03:47
[buffer.c]
do not expand buffer before attempting to reallocate it; markus ok
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | buffer.c | 13 |
2 files changed, 15 insertions, 7 deletions
@@ -1,7 +1,12 @@ | |||
1 | 20030916 | 1 | 20030916 |
2 | - (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve | 2 | - (dtucker) [acconfig.h configure.ac defines.h session.c] Bug #252: Retrieve |
3 | PATH (or SUPATH) and UMASK from /etc/default/login on platforms that have it | 3 | PATH (or SUPATH) and UMASK from /etc/default/login on platforms that have it |
4 | eg Solaris, Reliant Unix. Patch from Robert.Dahlem at siemens.com. ok djm@ | 4 | (eg Solaris, Reliant Unix). Patch from Robert.Dahlem at siemens.com. |
5 | ok djm@ | ||
6 | - (bal) OpenBSD Sync | ||
7 | - deraadt@cvs.openbsd.org 2003/09/16 03:03:47 | ||
8 | [buffer.c] | ||
9 | do not expand buffer before attempting to reallocate it; markus ok | ||
5 | 10 | ||
6 | 20030914 | 11 | 20030914 |
7 | - (dtucker) [Makefile regress/Makefile] Fix portability issues preventing | 12 | - (dtucker) [Makefile regress/Makefile] Fix portability issues preventing |
@@ -1098,4 +1103,4 @@ | |||
1098 | - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. | 1103 | - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. |
1099 | Report from murple@murple.net, diagnosis from dtucker@zip.com.au | 1104 | Report from murple@murple.net, diagnosis from dtucker@zip.com.au |
1100 | 1105 | ||
1101 | $Id: ChangeLog,v 1.2993 2003/09/16 03:24:50 dtucker Exp $ | 1106 | $Id: ChangeLog,v 1.2994 2003/09/16 03:31:03 mouring Exp $ |
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$OpenBSD: buffer.c,v 1.16 2002/06/26 08:54:18 markus Exp $"); | 15 | RCSID("$OpenBSD: buffer.c,v 1.17 2003/09/16 03:03:47 deraadt Exp $"); |
16 | 16 | ||
17 | #include "xmalloc.h" | 17 | #include "xmalloc.h" |
18 | #include "buffer.h" | 18 | #include "buffer.h" |
@@ -69,6 +69,7 @@ buffer_append(Buffer *buffer, const void *data, u_int len) | |||
69 | void * | 69 | void * |
70 | buffer_append_space(Buffer *buffer, u_int len) | 70 | buffer_append_space(Buffer *buffer, u_int len) |
71 | { | 71 | { |
72 | u_int newlen; | ||
72 | void *p; | 73 | void *p; |
73 | 74 | ||
74 | if (len > 0x100000) | 75 | if (len > 0x100000) |
@@ -98,11 +99,13 @@ restart: | |||
98 | goto restart; | 99 | goto restart; |
99 | } | 100 | } |
100 | /* Increase the size of the buffer and retry. */ | 101 | /* Increase the size of the buffer and retry. */ |
101 | buffer->alloc += len + 32768; | 102 | |
102 | if (buffer->alloc > 0xa00000) | 103 | newlen = buffer->alloc + len + 32768; |
104 | if (newlen > 0xa00000) | ||
103 | fatal("buffer_append_space: alloc %u not supported", | 105 | fatal("buffer_append_space: alloc %u not supported", |
104 | buffer->alloc); | 106 | newlen); |
105 | buffer->buf = xrealloc(buffer->buf, buffer->alloc); | 107 | buffer->buf = xrealloc(buffer->buf, newlen); |
108 | buffer->alloc = newlen; | ||
106 | goto restart; | 109 | goto restart; |
107 | /* NOTREACHED */ | 110 | /* NOTREACHED */ |
108 | } | 111 | } |