Zero all sockaddr_XX.
This commit is contained in:
parent
a140727528
commit
5a137fe9db
|
@ -86,6 +86,8 @@ int scheme_connect(int sockfd, int family, scheme_value scheme_name)
|
||||||
struct sockaddr_un name;
|
struct sockaddr_un name;
|
||||||
int scheme_length=STRING_LENGTH(scheme_name);
|
int scheme_length=STRING_LENGTH(scheme_name);
|
||||||
|
|
||||||
|
memset(&name, 0, sizeof(name));
|
||||||
|
|
||||||
name.sun_family=AF_UNIX;
|
name.sun_family=AF_UNIX;
|
||||||
if (scheme_length>=(108-1)) /* save space for \0 */
|
if (scheme_length>=(108-1)) /* save space for \0 */
|
||||||
return(-1);
|
return(-1);
|
||||||
|
@ -104,6 +106,8 @@ int scheme_connect(int sockfd, int family, scheme_value scheme_name)
|
||||||
u_long addr=GET_LONG(scheme_name,0);
|
u_long addr=GET_LONG(scheme_name,0);
|
||||||
u_short port=htons((u_short)ntohl(GET_LONG(scheme_name,1)));
|
u_short port=htons((u_short)ntohl(GET_LONG(scheme_name,1)));
|
||||||
|
|
||||||
|
memset(&name, 0, sizeof(name));
|
||||||
|
|
||||||
name.sin_family=AF_INET;
|
name.sin_family=AF_INET;
|
||||||
name.sin_addr.s_addr=addr;
|
name.sin_addr.s_addr=addr;
|
||||||
name.sin_port=port;
|
name.sin_port=port;
|
||||||
|
@ -274,6 +278,8 @@ int send_substring(int s,
|
||||||
struct sockaddr_un name;
|
struct sockaddr_un name;
|
||||||
int scheme_length=STRING_LENGTH(scheme_name);
|
int scheme_length=STRING_LENGTH(scheme_name);
|
||||||
|
|
||||||
|
memset(&name, 0, sizeof(name));
|
||||||
|
|
||||||
name.sun_family=AF_UNIX;
|
name.sun_family=AF_UNIX;
|
||||||
if (scheme_length>=(108-1)) /* save space for \0 */
|
if (scheme_length>=(108-1)) /* save space for \0 */
|
||||||
return(-1);
|
return(-1);
|
||||||
|
@ -293,6 +299,9 @@ int send_substring(int s,
|
||||||
struct sockaddr_in name;
|
struct sockaddr_in name;
|
||||||
u_long addr=GET_LONG(scheme_name,0);
|
u_long addr=GET_LONG(scheme_name,0);
|
||||||
u_short port=htons((u_short)ntohl(GET_LONG(scheme_name,1)));
|
u_short port=htons((u_short)ntohl(GET_LONG(scheme_name,1)));
|
||||||
|
|
||||||
|
memset(&name, 0, sizeof(name));
|
||||||
|
|
||||||
name.sin_family=AF_INET;
|
name.sin_family=AF_INET;
|
||||||
name.sin_addr.s_addr=addr;
|
name.sin_addr.s_addr=addr;
|
||||||
name.sin_port=port;
|
name.sin_port=port;
|
||||||
|
|
Loading…
Reference in New Issue