diff options
Diffstat (limited to 'openbsd-compat/port-tun.c')
-rw-r--r-- | openbsd-compat/port-tun.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c index 0d756f74f..7b58ea678 100644 --- a/openbsd-compat/port-tun.c +++ b/openbsd-compat/port-tun.c | |||
@@ -32,8 +32,9 @@ | |||
32 | #include "openbsd-compat/sys-queue.h" | 32 | #include "openbsd-compat/sys-queue.h" |
33 | #include "log.h" | 33 | #include "log.h" |
34 | #include "misc.h" | 34 | #include "misc.h" |
35 | #include "buffer.h" | 35 | #include "sshbuf.h" |
36 | #include "channels.h" | 36 | #include "channels.h" |
37 | #include "ssherr.h" | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * This is the portable version of the SSH tunnel forwarding, it | 40 | * This is the portable version of the SSH tunnel forwarding, it |
@@ -210,6 +211,7 @@ sys_tun_infilter(struct Channel *c, char *buf, int len) | |||
210 | #endif | 211 | #endif |
211 | u_int32_t *af; | 212 | u_int32_t *af; |
212 | char *ptr = buf; | 213 | char *ptr = buf; |
214 | int r; | ||
213 | 215 | ||
214 | #if defined(SSH_TUN_PREPEND_AF) | 216 | #if defined(SSH_TUN_PREPEND_AF) |
215 | if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af))) | 217 | if (len <= 0 || len > (int)(sizeof(rbuf) - sizeof(*af))) |
@@ -242,17 +244,20 @@ sys_tun_infilter(struct Channel *c, char *buf, int len) | |||
242 | *af = htonl(OPENBSD_AF_INET); | 244 | *af = htonl(OPENBSD_AF_INET); |
243 | #endif | 245 | #endif |
244 | 246 | ||
245 | buffer_put_string(&c->input, ptr, len); | 247 | if ((r = sshbuf_put_string(&c->input, ptr, len)) != 0) |
248 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | ||
246 | return (0); | 249 | return (0); |
247 | } | 250 | } |
248 | 251 | ||
249 | u_char * | 252 | u_char * |
250 | sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen) | 253 | sys_tun_outfilter(struct Channel *c, u_char **data, size_t *dlen) |
251 | { | 254 | { |
252 | u_char *buf; | 255 | u_char *buf; |
253 | u_int32_t *af; | 256 | u_int32_t *af; |
257 | int r; | ||
254 | 258 | ||
255 | *data = buffer_get_string(&c->output, dlen); | 259 | if ((r = sshbuf_get_string(&c->output, data, dlen)) != 0) |
260 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | ||
256 | if (*dlen < sizeof(*af)) | 261 | if (*dlen < sizeof(*af)) |
257 | return (NULL); | 262 | return (NULL); |
258 | buf = *data; | 263 | buf = *data; |