summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-tun.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2015-08-19 14:23:50 +0100
committerColin Watson <cjwatson@debian.org>2015-08-19 14:23:50 +0100
commitbaccdb349b31c47cd76fb63211f754ed33a9707e (patch)
treed03653f975fd4eb8bf71bb0c9d168614401202fa /openbsd-compat/port-tun.c
parent487bdb3a5ef6075887b830ccb8a0b14f6da78e93 (diff)
parent9f82e5a9042f2d872e98f48a876fcab3e25dd9bb (diff)
Import openssh_6.8p1.orig.tar.gz
Diffstat (limited to 'openbsd-compat/port-tun.c')
-rw-r--r--openbsd-compat/port-tun.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/openbsd-compat/port-tun.c b/openbsd-compat/port-tun.c
index 0d756f74f..49e7b4d99 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,7 +244,8 @@ 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
@@ -251,8 +254,14 @@ sys_tun_outfilter(struct Channel *c, u_char **data, u_int *dlen)
251{ 254{
252 u_char *buf; 255 u_char *buf;
253 u_int32_t *af; 256 u_int32_t *af;
254 257 int r;
255 *data = buffer_get_string(&c->output, dlen); 258 size_t xxx_dlen;
259
260 /* XXX new API is incompatible with this signature. */
261 if ((r = sshbuf_get_string(&c->output, data, &xxx_dlen)) != 0)
262 fatal("%s: buffer error: %s", __func__, ssh_err(r));
263 if (dlen != NULL)
264 *dlen = xxx_dlen;
256 if (*dlen < sizeof(*af)) 265 if (*dlen < sizeof(*af))
257 return (NULL); 266 return (NULL);
258 buf = *data; 267 buf = *data;