From: David Edmondson <dme@dme.org>
To: emacs-devel@gnu.org
Subject: [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses
Date: Sat, 06 Feb 2016 16:06:17 +0000 [thread overview]
Message-ID: <m2twll6cxy.fsf@heart-of-gold.hh.sledj.net> (raw)
When trying to test Lars' async-dns changes I encountered memory
corruption whenever the addresses returned for a host included IPv6
addresses. This turns out to be a bug in the mainline code which is just
more likely to be tickled by the async-dns changes because they convert
addresses to lisp objects whenever `make-network-process' is called (the
current code doesn't do that).
Here is a proposed fix:
From c9995971d47e78475fb5ec9d9b34d2187941227f Mon Sep 17 00:00:00 2001
Date: Sat, 6 Feb 2016 16:02:23 +0000
Subject: [PATCH] * src/process.c (conv_lisp_to_sockaddr): Correctly convert
AF_INET6 addresses
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.
---
src/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/process.c b/src/process.c
index e1ebdff..1eac5e1 100644
--- a/src/process.c
+++ b/src/process.c
@@ -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++)
--
2.6.3
next reply other threads:[~2016-02-06 16:06 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-06 16:06 David Edmondson [this message]
2016-02-07 1:45 ` [PATCH] fix conv_lisp_to_sockaddr for AF_INET6 addresses Lars Ingebrigtsen
2016-02-07 1:50 ` Lars Ingebrigtsen
2016-02-07 17:52 ` John Wiegley
2016-02-08 1:29 ` Lars Ingebrigtsen
2016-02-08 3:34 ` Eli Zaretskii
2016-02-08 3:59 ` Lars Ingebrigtsen
2016-02-08 4:01 ` Lars Ingebrigtsen
2016-02-08 4:07 ` Lars Ingebrigtsen
2016-02-08 7:03 ` Michael Albinus
2016-02-08 7:26 ` Lars Ingebrigtsen
2016-02-08 17:04 ` Eli Zaretskii
2016-02-08 23:17 ` Lars Ingebrigtsen
2016-02-09 19:13 ` Eli Zaretskii
2016-02-09 23:07 ` Lars Ingebrigtsen
2016-02-10 20:08 ` Eli Zaretskii
2016-02-10 20:31 ` Eli Zaretskii
2016-02-11 3:54 ` Lars Ingebrigtsen
2016-02-13 13:19 ` Eli Zaretskii
2016-02-08 3:43 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2twll6cxy.fsf@heart-of-gold.hh.sledj.net \
--to=dme@dme.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).