=== modified file 'plugins.d/mandos-client.c' --- plugins.d/mandos-client.c 2015-07-12 01:07:14 +0000 +++ plugins.d/mandos-client.c 2015-07-16 23:01:02 +0000 @@ -46,8 +46,8 @@ #include /* free(), EXIT_SUCCESS, srand(), strtof(), abort() */ #include /* bool, false, true */ -#include /* memset(), strcmp(), strlen(), - strerror(), asprintf(), strcpy() */ +#include /* strcmp(), strlen(), strerror(), + asprintf(), strcpy() */ #include /* ioctl */ #include /* socket(), inet_pton(), sockaddr, sockaddr_in6, PF_INET6, @@ -1130,13 +1130,14 @@ goto mandos_end; } - memset(&to, 0, sizeof(to)); if(af == AF_INET6){ - ((struct sockaddr_in6 *)&to)->sin6_family = (sa_family_t)af; - ret = inet_pton(af, ip, &((struct sockaddr_in6 *)&to)->sin6_addr); + struct sockaddr_in6 *to6 = (struct sockaddr_in6 *)&to; + *to6 = (struct sockaddr_in6){ .sin6_family = (sa_family_t)af }; + ret = inet_pton(af, ip, &to6->sin6_addr); } else { /* IPv4 */ - ((struct sockaddr_in *)&to)->sin_family = (sa_family_t)af; - ret = inet_pton(af, ip, &((struct sockaddr_in *)&to)->sin_addr); + struct sockaddr_in *to4 = (struct sockaddr_in *)&to; + *to4 = (struct sockaddr_in){ .sin_family = (sa_family_t)af }; + ret = inet_pton(af, ip, &to4->sin_addr); } if(ret < 0 ){ int e = errno;