diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2014-02-26 20:29:30 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2014-02-26 20:29:30 +0000 |
commit | 637242cc04bc402b8f59f0f703cac9823f28e92a (patch) | |
tree | 2318b2677d50c34c1b4c9889afd23c730ddb5704 /usr.bin/ssh/channels.c | |
parent | 542e5d2eba7f9ee31d71925de59abe2378739fc7 (diff) |
don't assume that the socks4 username is \0 terminated;
spotted by Ben Hawkes; ok markus@
Diffstat (limited to 'usr.bin/ssh/channels.c')
-rw-r--r-- | usr.bin/ssh/channels.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 385a16db4df..d1d77744cf5 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.330 2014/02/15 23:05:36 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.331 2014/02/26 20:29:29 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1064,6 +1064,9 @@ channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset) buffer_get(&c->input, (char *)&s4_req.dest_addr, 4); have = buffer_len(&c->input); p = buffer_ptr(&c->input); + if (memchr(p, '\0', have) == NULL) + fatal("channel %d: decode socks4: user not nul terminated", + c->self); len = strlen(p); debug2("channel %d: decode socks4: user %s/%d", c->self, p, len); len++; /* trailing '\0' */ |