]> code.delx.au - gnu-emacs/commitdiff
src/process.c Correctly convert AF_INET6 addresses
authorDavid Edmondson <dme@dme.org>
Sun, 7 Feb 2016 01:54:08 +0000 (12:54 +1100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 7 Feb 2016 01:55:57 +0000 (12:55 +1100)
* src/process.c (conv_lisp_to_sockaddr): AF_INET6 addresses are
converted to a list of 16 bit quantities by
conv_sockaddr_to_lisp(). conv_lisp_to_sockaddr() should follow the
same scheme rather than expecting a (longer) list of 8 bit
quantities.

Backport:

(cherry picked from commit 55ce3c30d617c38eb086d5ad4ffbd881c20c559c)

src/process.c

index e1ebdff7430d63ea2547809a32c5aa1ea761b9ee..1eac5e12663b70967fc921d2702cae9b1c66e133 100644 (file)
@@ -2372,7 +2372,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
        {
          struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
          uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr;
-         len = sizeof (sin6->sin6_addr) + 1;
+         len = sizeof (sin6->sin6_addr) / 2 + 1;
          hostport = XINT (p->contents[--len]);
          sin6->sin6_port = htons (hostport);
          for (i = 0; i < len; i++)