diff options
Diffstat (limited to 'src/process.c')
-rw-r--r-- | src/process.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/process.c b/src/process.c index eab9daa6bdd..8e4a0d22160 100644 --- a/src/process.c +++ b/src/process.c @@ -2323,7 +2323,11 @@ get_lisp_to_sockaddr_size (address, familyp) } /* Convert an address object (vector or string) to an internal sockaddr. - Format of address has already been validated by size_lisp_to_sockaddr. */ + + The address format has been basically validated by + get_lisp_to_sockaddr_size, but this does not mean FAMILY is valid; + it could have come from user data. So if FAMILY is not valid, + we return after zeroing *SA. */ static void conv_lisp_to_sockaddr (family, address, sa, len) @@ -2337,7 +2341,6 @@ conv_lisp_to_sockaddr (family, address, sa, len) register int i; bzero (sa, len); - sa->sa_family = family; if (VECTORP (address)) { @@ -2349,6 +2352,7 @@ conv_lisp_to_sockaddr (family, address, sa, len) i = XINT (p->contents[--len]); sin->sin_port = htons (i); cp = (unsigned char *)&sin->sin_addr; + sa->sa_family = family; } #ifdef AF_INET6 else if (family == AF_INET6) @@ -2364,9 +2368,10 @@ conv_lisp_to_sockaddr (family, address, sa, len) int j = XFASTINT (p->contents[i]) & 0xffff; ip6[i] = ntohs (j); } - return; + sa->sa_family = family; } #endif + return; } else if (STRINGP (address)) { @@ -2377,6 +2382,7 @@ conv_lisp_to_sockaddr (family, address, sa, len) cp = SDATA (address); for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++) sockun->sun_path[i] = *cp++; + sa->sa_family = family; } #endif return; @@ -6229,6 +6235,8 @@ text to PROCESS after you call this function. */) emacs_close (XINT (XPROCESS (proc)->outfd)); #endif /* not HAVE_SHUTDOWN */ new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); + if (new_outfd < 0) + abort (); old_outfd = XINT (XPROCESS (proc)->outfd); if (!proc_encode_coding_system[new_outfd]) |