summaryrefslogtreecommitdiff
path: root/bufaux.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2009-12-29 21:42:53 +0000
committerColin Watson <cjwatson@debian.org>2009-12-29 21:42:53 +0000
commit87552344215a38d3a2b0d4d63dc151e05978bbe1 (patch)
tree9f4b96055e6ccaa915e8d59d9f2805e9e119371d /bufaux.c
parenta25ec0b132c44c9e341e08464ff830de06b81126 (diff)
parentef94e5613d37bcbf880f21ee6094e4b1c7683a4c (diff)
import openssh-5.1p1-gsskex-cjwatson-20080722.patch
Diffstat (limited to 'bufaux.c')
-rw-r--r--bufaux.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/bufaux.c b/bufaux.c
index cbdc22c64..cd9a35ded 100644
--- a/bufaux.c
+++ b/bufaux.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bufaux.c,v 1.44 2006/08/03 03:34:41 deraadt Exp $ */ 1/* $OpenBSD: bufaux.c,v 1.46 2008/06/10 23:21:34 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * 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)
180 return (NULL); 180 return (NULL);
181 } 181 }
182 /* Append a null character to make processing easier. */ 182 /* Append a null character to make processing easier. */
183 value[len] = 0; 183 value[len] = '\0';
184 /* Optionally return the length of the string. */ 184 /* Optionally return the length of the string. */
185 if (length_ptr) 185 if (length_ptr)
186 *length_ptr = len; 186 *length_ptr = len;
@@ -197,6 +197,22 @@ buffer_get_string(Buffer *buffer, u_int *length_ptr)
197 return (ret); 197 return (ret);
198} 198}
199 199
200void *
201buffer_get_string_ptr(Buffer *buffer, u_int *length_ptr)
202{
203 void *ptr;
204 u_int len;
205
206 len = buffer_get_int(buffer);
207 if (len > 256 * 1024)
208 fatal("buffer_get_string_ptr: bad string length %u", len);
209 ptr = buffer_ptr(buffer);
210 buffer_consume(buffer, len);
211 if (length_ptr)
212 *length_ptr = len;
213 return (ptr);
214}
215
200/* 216/*
201 * Stores and arbitrary binary string in the buffer. 217 * Stores and arbitrary binary string in the buffer.
202 */ 218 */