Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/crypto/dist/ssh Pull up revision 1.3 (requested by elri...



details:   https://anonhg.NetBSD.org/src/rev/370647f42e3e
branches:  netbsd-1-6
changeset: 530714:370647f42e3e
user:      grant <grant%NetBSD.org@localhost>
date:      Tue Sep 16 17:57:56 2003 +0000

description:
Pull up revision 1.3 (requested by elric in ticket #1471):

Do not record expanded size before attempting to reallocate the associated
memory. From OpenBSD, via FreeBSD.

diffstat:

 crypto/dist/ssh/buffer.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r 977f88d0acb4 -r 370647f42e3e crypto/dist/ssh/buffer.c
--- a/crypto/dist/ssh/buffer.c  Fri Sep 12 19:17:07 2003 +0000
+++ b/crypto/dist/ssh/buffer.c  Tue Sep 16 17:57:56 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buffer.c,v 1.1.1.6.2.1 2002/06/26 16:53:02 tv Exp $    */
+/*     $NetBSD: buffer.c,v 1.1.1.6.2.2 2003/09/16 17:57:56 grant Exp $ */
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
  * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -70,6 +70,7 @@
 void *
 buffer_append_space(Buffer *buffer, u_int len)
 {
+       u_int newlen;
        void *p;
 
        if (len > 0x100000)
@@ -99,11 +100,12 @@
                goto restart;
        }
        /* Increase the size of the buffer and retry. */
-       buffer->alloc += len + 32768;
-       if (buffer->alloc > 0xa00000)
+       newlen = buffer->alloc + len + 32768;
+       if (newlen > 0xa00000)
                fatal("buffer_append_space: alloc %u not supported",
-                   buffer->alloc);
-       buffer->buf = xrealloc(buffer->buf, buffer->alloc);
+                   newlen);
+       buffer->buf = xrealloc(buffer->buf, newlen);
+       buffer->alloc = newlen;
        goto restart;
        /* NOTREACHED */
 }



Home | Main Index | Thread Index | Old Index