=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/Attic/bufaux.c,v retrieving revision 1.43 retrieving revision 1.46 diff -u -r1.43 -r1.46 --- src/usr.bin/ssh/Attic/bufaux.c 2006/07/22 20:48:22 1.43 +++ src/usr.bin/ssh/Attic/bufaux.c 2008/06/10 23:21:34 1.46 @@ -1,4 +1,4 @@ -/* $OpenBSD: bufaux.c,v 1.43 2006/07/22 20:48:22 stevesk Exp $ */ +/* $OpenBSD: bufaux.c,v 1.46 2008/06/10 23:21:34 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -37,14 +37,15 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "includes.h" +#include #include #include +#include -#include "bufaux.h" #include "xmalloc.h" +#include "buffer.h" #include "log.h" #include "misc.h" @@ -177,7 +178,7 @@ return (NULL); } /* Append a null character to make processing easier. */ - value[len] = 0; + value[len] = '\0'; /* Optionally return the length of the string. */ if (length_ptr) *length_ptr = len; @@ -192,6 +193,22 @@ if ((ret = buffer_get_string_ret(buffer, length_ptr)) == NULL) fatal("buffer_get_string: buffer error"); return (ret); +} + +void * +buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr) +{ + void *ptr; + u_int len; + + len = buffer_get_int(buffer); + if (len > 256 * 1024) + fatal("buffer_get_string_ptr: bad string length %u", len); + ptr = buffer_ptr(buffer); + buffer_consume(buffer, len); + if (length_ptr) + *length_ptr = len; + return (ptr); } /*