[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 03/14: fix unaligned access
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 03/14: fix unaligned access |
Date: |
Mon, 23 Jan 2017 14:42:43 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 990c75c9d7d1c8eb3d68c1eb9f49d131abb0deaa
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Jan 23 14:01:34 2017 +0100
fix unaligned access
---
src/nat/gnunet-service-nat.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/nat/gnunet-service-nat.c b/src/nat/gnunet-service-nat.c
index 98d87262e..bfe212308 100644
--- a/src/nat/gnunet-service-nat.c
+++ b/src/nat/gnunet-service-nat.c
@@ -1434,8 +1434,8 @@ handle_register (void *cls,
off = (const char *) &message[1];
for (unsigned int i=0;i<ch->num_caddrs;i++)
{
- size_t alen;
const struct sockaddr *sa = (const struct sockaddr *) off;
+ size_t alen;
uint16_t port;
int is_nat;
@@ -1450,22 +1450,28 @@ handle_register (void *cls,
{
case AF_INET:
{
- const struct sockaddr_in *s4 = (const struct sockaddr_in *) sa;
+ struct sockaddr_in s4;
+ GNUNET_memcpy (&s4,
+ off,
+ sizeof (struct sockaddr_in));
alen = sizeof (struct sockaddr_in);
- if (is_nat_v4 (&s4->sin_addr))
+ if (is_nat_v4 (&s4.sin_addr))
is_nat = GNUNET_YES;
- port = ntohs (s4->sin_port);
+ port = ntohs (s4.sin_port);
}
break;
case AF_INET6:
{
- const struct sockaddr_in6 *s6 = (const struct sockaddr_in6 *) sa;
+ struct sockaddr_in6 s6;
+ GNUNET_memcpy (&s6,
+ off,
+ sizeof (struct sockaddr_in6));
alen = sizeof (struct sockaddr_in6);
- if (is_nat_v6 (&s6->sin6_addr))
+ if (is_nat_v6 (&s6.sin6_addr))
is_nat = GNUNET_YES;
- port = ntohs (s6->sin6_port);
+ port = ntohs (s6.sin6_port);
}
break;
#if AF_UNIX
@@ -1483,7 +1489,7 @@ handle_register (void *cls,
GNUNET_assert (alen <= left);
GNUNET_assert (alen <= sizeof (struct sockaddr_storage));
GNUNET_memcpy (&ch->caddrs[i].ss,
- sa,
+ off,
alen);
/* If applicable, try UPNPC NAT punching */
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 07/14: handle disconnect properly in test, (continued)
- [GNUnet-SVN] [gnunet] 07/14: handle disconnect properly in test, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 06/14: add generated file to ignore list, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 05/14: get rid of redundant, confusing state, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 12/14: add sender argument to GCCH_handle_local_data so we can implement loopback, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 10/14: towards path desirability calculations, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 02/14: fix shutdown sequence, start to handle loopback, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 11/14: use correct header size calculation in test, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 01/14: allow more than one ACK being given to us at a time, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 09/14: another special case for loopback, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 13/14: avoid asserting in API on timeout destruction, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 03/14: fix unaligned access,
gnunet <=
- [GNUnet-SVN] [gnunet] 04/14: more implementation of loopback handling, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 08/14: beautify disconnect logic a bit, gnunet, 2017/01/23
- [GNUnet-SVN] [gnunet] 14/14: more work on loopback, this time payload transmission (for now without flow control), gnunet, 2017/01/23