mirror of
https://github.com/openssh/libopenssh
synced 2026-04-17 02:06:45 +00:00
make sshbuf_get_stringb() a public API
This commit is contained in:
@@ -192,6 +192,26 @@ sshbuf_get_cstring(struct sshbuf *buf, char **valp, size_t *lenp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sshbuf_get_stringb(struct sshbuf *buf, struct sshbuf *v)
|
||||
{
|
||||
u_int32_t len;
|
||||
u_char *p;
|
||||
int r;
|
||||
|
||||
/*
|
||||
* Use sshbuf_peek_string_direct() to figure out if there is
|
||||
* a complete string in 'buf' and copy the string directly
|
||||
* into 'v'.
|
||||
*/
|
||||
if ((r = sshbuf_peek_string_direct(buf, NULL, NULL)) != 0 ||
|
||||
(r = sshbuf_get_u32(buf, &len)) != 0 ||
|
||||
(r = sshbuf_reserve(v, len, &p)) != 0 ||
|
||||
(r = sshbuf_get(buf, p, len)) != 0)
|
||||
return r;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sshbuf_put(struct sshbuf *buf, const void *v, size_t len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user