Skip to content

Commit

Permalink
Ensure structs are set to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Sep 21, 2014
1 parent 6dead33 commit 38abce9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/misc.c
Expand Up @@ -1201,6 +1201,8 @@ int fr_ipaddr_cmp(fr_ipaddr_t const *a, fr_ipaddr_t const *b)
int fr_ipaddr2sockaddr(fr_ipaddr_t const *ipaddr, uint16_t port,
struct sockaddr_storage *sa, socklen_t *salen)
{
memset(sa, 0, sizeof(*sa));

if (ipaddr->af == AF_INET) {
struct sockaddr_in s4;

Expand Down Expand Up @@ -1238,6 +1240,8 @@ int fr_ipaddr2sockaddr(fr_ipaddr_t const *ipaddr, uint16_t port,
int fr_sockaddr2ipaddr(struct sockaddr_storage const *sa, socklen_t salen,
fr_ipaddr_t *ipaddr, uint16_t *port)
{
memset(ipaddr, 0, sizeof(*ipaddr));

if (sa->ss_family == AF_INET) {
struct sockaddr_in s4;

Expand Down

0 comments on commit 38abce9

Please sign in to comment.