emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/process.c


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/process.c
Date: Thu, 13 Apr 2006 01:08:00 +0000

Index: emacs/src/process.c
diff -u emacs/src/process.c:1.479 emacs/src/process.c:1.480
--- emacs/src/process.c:1.479   Wed Apr 12 15:01:37 2006
+++ emacs/src/process.c Thu Apr 13 01:08:00 2006
@@ -2322,9 +2322,11 @@
 }
 
 /* Convert an address object (vector or string) to an internal sockaddr.
-   Address format has already been validated by get_lisp_to_sockaddr_size,
-   but just to be nice, we return without doing anything
-   if FAMILY is not valid.  */
+
+   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)
@@ -2338,7 +2340,6 @@
   register int i;
 
   bzero (sa, len);
-  sa->sa_family = family;
 
   if (VECTORP (address))
     {
@@ -2350,6 +2351,7 @@
          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)
@@ -2365,7 +2367,7 @@
                int j = XFASTINT (p->contents[i]) & 0xffff;
                ip6[i] = ntohs (j);
              }
-         return;
+         sa->sa_family = family;
        }
 #endif
       return;
@@ -2379,6 +2381,7 @@
          cp = SDATA (address);
          for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++)
            sockun->sun_path[i] = *cp++;
+         sa->sa_family = family;
        }
 #endif
       return;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]