summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-02-27 10:18:32 +1100
committerDamien Miller <djm@mindrot.org>2014-02-27 10:18:32 +1100
commit1348129a34f0f7728c34d86c100a32dcc8d1f922 (patch)
treee19e82fc34e0f3fe27eb2f589cacf826a1a97f02
parente6a74aeeacd01d885262ff8e50eb28faee8c8039 (diff)
- djm@cvs.openbsd.org 2014/02/26 20:29:29
[channels.c] don't assume that the socks4 username is \0 terminated; spotted by Ben Hawkes; ok markus@
-rw-r--r--ChangeLog4
-rw-r--r--channels.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a4b551b9..f37b7e5fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
9 bz#2107 - cache OIDs of supported GSSAPI mechanisms before privsep 9 bz#2107 - cache OIDs of supported GSSAPI mechanisms before privsep
10 sandboxing, as running this code in the sandbox can cause violations; 10 sandboxing, as running this code in the sandbox can cause violations;
11 ok markus@ 11 ok markus@
12 - djm@cvs.openbsd.org 2014/02/26 20:29:29
13 [channels.c]
14 don't assume that the socks4 username is \0 terminated;
15 spotted by Ben Hawkes; ok markus@
12 16
1320140224 1720140224
14 - OpenBSD CVS Sync 18 - OpenBSD CVS Sync
diff --git a/channels.c b/channels.c
index 1052b80ca..9efe89c9c 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.330 2014/02/15 23:05:36 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.331 2014/02/26 20:29:29 djm 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
@@ -1072,6 +1072,9 @@ channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset)
1072 buffer_get(&c->input, (char *)&s4_req.dest_addr, 4); 1072 buffer_get(&c->input, (char *)&s4_req.dest_addr, 4);
1073 have = buffer_len(&c->input); 1073 have = buffer_len(&c->input);
1074 p = buffer_ptr(&c->input); 1074 p = buffer_ptr(&c->input);
1075 if (memchr(p, '\0', have) == NULL)
1076 fatal("channel %d: decode socks4: user not nul terminated",
1077 c->self);
1075 len = strlen(p); 1078 len = strlen(p);
1076 debug2("channel %d: decode socks4: user %s/%d", c->self, p, len); 1079 debug2("channel %d: decode socks4: user %s/%d", c->self, p, len);
1077 len++; /* trailing '\0' */ 1080 len++; /* trailing '\0' */