rb_inet_pton_sock: initialise sockaddr to zero
This commit is contained in:
parent
365e13662e
commit
9caecc9348
1 changed files with 1 additions and 0 deletions
|
@ -1307,6 +1307,7 @@ inet_ntop6(const unsigned char *src, char *dst, unsigned int size)
|
||||||
int
|
int
|
||||||
rb_inet_pton_sock(const char *src, struct sockaddr *dst)
|
rb_inet_pton_sock(const char *src, struct sockaddr *dst)
|
||||||
{
|
{
|
||||||
|
memset(dst, 0, sizeof(*dst));
|
||||||
if(rb_inet_pton(AF_INET, src, &((struct sockaddr_in *)dst)->sin_addr))
|
if(rb_inet_pton(AF_INET, src, &((struct sockaddr_in *)dst)->sin_addr))
|
||||||
{
|
{
|
||||||
SET_SS_FAMILY(dst, AF_INET);
|
SET_SS_FAMILY(dst, AF_INET);
|
||||||
|
|
Loading…
Reference in a new issue