summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/bufaux.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssh/bufaux.c')
-rw-r--r--crypto/openssh/bufaux.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/crypto/openssh/bufaux.c b/crypto/openssh/bufaux.c
index cbdc22c..cd9a35d 100644
--- a/crypto/openssh/bufaux.c
+++ b/crypto/openssh/bufaux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bufaux.c,v 1.44 2006/08/03 03:34:41 deraadt Exp $ */
+/* $OpenBSD: bufaux.c,v 1.46 2008/06/10 23:21:34 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -180,7 +180,7 @@ buffer_get_string_ret(Buffer *buffer, u_int *length_ptr)
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;
@@ -197,6 +197,22 @@ buffer_get_string(Buffer *buffer, u_int *length_ptr)
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);
+}
+
/*
* Stores and arbitrary binary string in the buffer.
*/
OpenPOWER on IntegriCloud