summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-09-14 09:49:43 +1000
committerDamien Miller <djm@mindrot.org>2013-09-14 09:49:43 +1000
commit13840e0103946982cee2a05c40697be7e57dca41 (patch)
tree4951a14d898e6023604ea76e4d18dc4b935ec89b
parent70182522a47d283513a010338cd028cb80dac2ab (diff)
- djm@cvs.openbsd.org 2013/09/13 06:54:34
[channels.c] avoid unaligned access in code that reused a buffer to send a struct in_addr in a reply; simpler just use use buffer_put_int(); from portable; spotted by and ok dtucker@
-rw-r--r--ChangeLog5
-rw-r--r--channels.c5
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b12c307c6..57721f8d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,11 @@
32 [clientloop.c] 32 [clientloop.c]
33 fix connection crash when sending break (~B) on ControlPersist'd session; 33 fix connection crash when sending break (~B) on ControlPersist'd session;
34 ok dtucker@ 34 ok dtucker@
35 - djm@cvs.openbsd.org 2013/09/13 06:54:34
36 [channels.c]
37 avoid unaligned access in code that reused a buffer to send a
38 struct in_addr in a reply; simpler just use use buffer_put_int();
39 from portable; spotted by and ok dtucker@
35 40
3620130828 4120130828
37 - (djm) [openbsd-compat/bsd-snprintf.c] teach our local snprintf code the 42 - (djm) [openbsd-compat/bsd-snprintf.c] teach our local snprintf code the
diff --git a/channels.c b/channels.c
index 281df3802..698fa6da2 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.c,v 1.324 2013/07/12 00:19:58 djm Exp $ */ 1/* $OpenBSD: channels.c,v 1.325 2013/09/13 06:54:34 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
@@ -1239,11 +1239,10 @@ channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset)
1239 s5_rsp.command = SSH_SOCKS5_SUCCESS; 1239 s5_rsp.command = SSH_SOCKS5_SUCCESS;
1240 s5_rsp.reserved = 0; /* ignored */ 1240 s5_rsp.reserved = 0; /* ignored */
1241 s5_rsp.atyp = SSH_SOCKS5_IPV4; 1241 s5_rsp.atyp = SSH_SOCKS5_IPV4;
1242 ((struct in_addr *)&dest_addr)->s_addr = INADDR_ANY;
1243 dest_port = 0; /* ignored */ 1242 dest_port = 0; /* ignored */
1244 1243
1245 buffer_append(&c->output, &s5_rsp, sizeof(s5_rsp)); 1244 buffer_append(&c->output, &s5_rsp, sizeof(s5_rsp));
1246 buffer_append(&c->output, &dest_addr, sizeof(struct in_addr)); 1245 buffer_put_int(&c->output, ntohl(INADDR_ANY)); /* bind address */
1247 buffer_append(&c->output, &dest_port, sizeof(dest_port)); 1246 buffer_append(&c->output, &dest_port, sizeof(dest_port));
1248 return 1; 1247 return 1;
1249} 1248}