mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
zero newly allocated sockaddrs
* libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Zero the sockaddrs, so we do not pass uninitialized memory to the kernel.
This commit is contained in:
parent
5a79300f85
commit
333a81ccba
1 changed files with 3 additions and 0 deletions
|
@ -796,6 +796,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
|
|||
port = scm_to_int (SCM_CAR (*args));
|
||||
*args = SCM_CDR (*args);
|
||||
soka = (struct sockaddr_in *) scm_malloc (sizeof (struct sockaddr_in));
|
||||
memset (soka, '\0', sizeof (struct sockaddr_in));
|
||||
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SIN_LEN
|
||||
soka->sin_len = sizeof (struct sockaddr_in);
|
||||
|
@ -1131,6 +1132,8 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
{
|
||||
struct sockaddr_in c_inet;
|
||||
|
||||
memset (&c_inet, '\0', sizeof (struct sockaddr_in));
|
||||
|
||||
c_inet.sin_addr.s_addr =
|
||||
htonl (scm_to_ulong (SCM_SIMPLE_VECTOR_REF (address, 1)));
|
||||
c_inet.sin_port =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue