* socket.c (scm_fill_sockaddr): zero the address structure before
authorGary Houston <ghouston@arglist.com>
Thu, 4 Nov 1999 20:04:18 +0000 (20:04 +0000)
committerGary Houston <ghouston@arglist.com>
Thu, 4 Nov 1999 20:04:18 +0000 (20:04 +0000)
use, in case it has a sin_len field and the OS doesn't like random
values (thanks to Bertrand Petit).

THANKS
libguile/ChangeLog
libguile/socket.c

diff --git a/THANKS b/THANKS
index 7fd7ced..6bd0c35 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -7,5 +7,6 @@ Bug reports and fixes from:
      Lauri Alanko
       Greg Harvey
     Roland Orre
+  Bertrand Petit
     Jorgen Schaefer
    Bernard Urban
index 746ad83..5cdcc95 100644 (file)
@@ -1,3 +1,9 @@
+1999-11-03  Gary Houston  <ghouston@freewire.co.uk>
+
+       * socket.c (scm_fill_sockaddr): zero the address structure before
+       use, in case it has a sin_len field and the OS doesn't like random
+       values (thanks to Bertrand Petit).
+
 1999-10-26  Mark Galassi  <rosalia@lanl.gov>
 
        * gh.h, gh_data.c (gh_symbol2scm): changed gh_symbol2scm() to take
index 6513346..1447e94 100644 (file)
@@ -325,6 +325,8 @@ scm_fill_sockaddr (fam, address, args, which_arg, proc, size)
 
        soka = (struct sockaddr_in *)
          scm_must_malloc (sizeof (struct sockaddr_in), proc);
+       /* e.g., for BSDs which don't like invalid sin_len.  */
+       memset (soka, 0, sizeof (struct sockaddr_in));
        soka->sin_family = AF_INET;
        soka->sin_addr.s_addr =
          htonl (scm_num2ulong (address, (char *) which_arg, proc));
@@ -344,6 +346,7 @@ scm_fill_sockaddr (fam, address, args, which_arg, proc, size)
 
        soka = (struct sockaddr_un *)
          scm_must_malloc (sizeof (struct sockaddr_un), proc);
+       memset (soka, 0, sizeof (struct sockaddr_un));
        soka->sun_family = AF_UNIX;
        SCM_ASSERT (SCM_NIMP (address) && SCM_ROSTRINGP (address), address,
                    which_arg, proc);