Zero all sockaddr_XX.

This commit is contained in:
mainzelm 2001-06-21 08:22:18 +00:00
parent dcc88cce36
commit 4659f69310
1 changed files with 10 additions and 1 deletions

View File

@ -76,6 +76,8 @@ s48_value scheme_connect(s48_value sock, s48_value family, s48_value scheme_name
int ret;
int scheme_length=S48_STRING_LENGTH(scheme_name);
memset(&name, 0, sizeof(name));
name.sun_family=AF_UNIX;
if (scheme_length>=(108-1)) /* save space for \0 */
return(-1);
@ -106,6 +108,8 @@ s48_value scheme_connect(s48_value sock, s48_value family, s48_value scheme_name
u_long addr= htonl(s48_extract_unsigned_integer (S48_CAR (scheme_name)));
u_short port= htons(s48_extract_fixnum (S48_CDR (scheme_name)));
memset(&name, 0, sizeof(name));
name.sin_family=AF_INET;
name.sin_addr.s_addr=addr;
name.sin_port=port;
@ -316,7 +320,9 @@ s48_value send_substring(s48_value scm_sockfd,
{
struct sockaddr_un name;
int scheme_length=S48_STRING_LENGTH(scheme_name);
memset(&name, 0, sizeof(name));
name.sun_family=AF_UNIX;
if (scheme_length>=(108-1)) /* save space for \0 */
return(-1);
@ -335,6 +341,9 @@ s48_value send_substring(s48_value scm_sockfd,
struct sockaddr_in name;
u_long addr = htonl (s48_extract_unsigned_integer (S48_CAR (scheme_name)));
u_short port = htons(s48_extract_fixnum (S48_CDR (scheme_name)));
memset(&name, 0, sizeof(name));
name.sin_family=AF_INET;
name.sin_addr.s_addr=addr;
name.sin_port=port;