diff options
author | Tobias Brunner <tobias@strongswan.org> | 2012-09-14 16:14:57 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2012-09-21 18:16:26 +0200 |
commit | e9a7779003de231a3488e400f353bd1cc7597fef (patch) | |
tree | ad91cea2c8fdb9ac7db84cdb80f9e4c8b897040c /src | |
parent | 9ba36c0f7f68af814c9805ec8ac11d2f3ae2f5d7 (diff) | |
download | strongswan-e9a7779003de231a3488e400f353bd1cc7597fef.tar.bz2 strongswan-e9a7779003de231a3488e400f353bd1cc7597fef.tar.xz |
Avoid memset in is_anyaddr()
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/host.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libstrongswan/utils/host.c b/src/libstrongswan/utils/host.c index 3a16138a4..e0206f315 100644 --- a/src/libstrongswan/utils/host.c +++ b/src/libstrongswan/utils/host.c @@ -74,20 +74,16 @@ METHOD(host_t, get_sockaddr_len, socklen_t*, METHOD(host_t, is_anyaddr, bool, private_host_t *this) { + static const u_int8_t zeroes[IPV6_LEN]; + switch (this->address.sa_family) { case AF_INET: { - u_int8_t zeroes[IPV4_LEN]; - - memset(zeroes, 0, IPV4_LEN); return memeq(zeroes, &(this->address4.sin_addr.s_addr), IPV4_LEN); } case AF_INET6: { - u_int8_t zeroes[IPV6_LEN]; - - memset(zeroes, 0, IPV6_LEN); return memeq(zeroes, &(this->address6.sin6_addr.s6_addr), IPV6_LEN); } default: |