Source-Changes-HG archive

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

[src/trunk]: src/crypto/dist/ssh protect against double free; #660; zardoz a...



details:   https://anonhg.NetBSD.org/src/rev/05019830e65c
branches:  trunk
changeset: 552082:05019830e65c
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Sep 18 08:16:40 2003 +0000

description:
protect against double free; #660;  zardoz at users.sf.net
from openbsd

diffstat:

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

diffs (32 lines):

diff -r 61c53601113f -r 05019830e65c crypto/dist/ssh/buffer.c
--- a/crypto/dist/ssh/buffer.c  Thu Sep 18 08:16:15 2003 +0000
+++ b/crypto/dist/ssh/buffer.c  Thu Sep 18 08:16:40 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buffer.c,v 1.4 2003/09/16 23:16:59 christos Exp $      */
+/*     $NetBSD: buffer.c,v 1.5 2003/09/18 08:16:40 itojun Exp $        */
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
  * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -14,7 +14,7 @@
 
 #include "includes.h"
 RCSID("$OpenBSD: buffer.c,v 1.16 2002/06/26 08:54:18 markus Exp $");
-__RCSID("$NetBSD: buffer.c,v 1.4 2003/09/16 23:16:59 christos Exp $");
+__RCSID("$NetBSD: buffer.c,v 1.5 2003/09/18 08:16:40 itojun Exp $");
 
 #include "xmalloc.h"
 #include "buffer.h"
@@ -40,9 +40,10 @@
 buffer_free(Buffer *buffer)
 {
        if (buffer->alloc > 0) {
-       memset(buffer->buf, 0, buffer->alloc);
-       xfree(buffer->buf);
-}
+               memset(buffer->buf, 0, buffer->alloc);
+               xfree(buffer->buf);
+               buffer->alloc = 0;
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index