all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Ken Brown <kbrown@cornell.edu>, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master a066fb1: Fix use-after-close in connect_network_socket
Date: Tue, 2 Aug 2016 00:32:40 -0700	[thread overview]
Message-ID: <6b0f65f3-2aed-858b-1979-1fdfc3e6c6fc@cs.ucla.edu> (raw)
In-Reply-To: <de8ff1ff-f01c-0cce-36ae-8882a02bea00@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 247 bytes --]

Ken Brown wrote:
> Did you perhaps get the condition (socket_to_use < 0) backwards?  If
> socket_to_use < 0, then it is not external_sock_fd that has been closed.

Yes, thanks, I think you're right. I installed the attached on master to fix that.

[-- Attachment #2: 0001-Fix-use-after-close-in-connect_network_socket.patch --]
[-- Type: text/x-diff, Size: 1095 bytes --]

From 10ae6903134d0c501ede683e698a4f0a36cd6297 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 2 Aug 2016 03:31:04 -0400
Subject: [PATCH] Fix use-after-close in connect_network_socket

* src/process.c (connect_network_socket):
Reverse sense of previous fix.  Problem reported by Ken Brown in:
http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00004.html
---
 src/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/process.c b/src/process.c
index bc2ac45..5e48e43 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3185,7 +3185,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
 	      xerrno = errno;
 	      emacs_close (s);
 	      s = -1;
-	      if (socket_to_use < 0)
+	      if (0 <= socket_to_use)
 		break;
 	      continue;
 	    }
@@ -3314,7 +3314,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
       specpdl_ptr = specpdl + count1;
       emacs_close (s);
       s = -1;
-      if (socket_to_use < 0)
+      if (0 <= socket_to_use)
 	break;
 
 #ifdef WINDOWSNT
-- 
2.5.5


      reply	other threads:[~2016-08-02  7:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160721092948.2203.76649@vcs.savannah.gnu.org>
     [not found] ` <20160721092948.D1106220159@vcs.savannah.gnu.org>
2016-08-01 11:43   ` [Emacs-diffs] master a066fb1: Fix use-after-close in connect_network_socket Ken Brown
2016-08-02  7:32     ` Paul Eggert [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6b0f65f3-2aed-858b-1979-1fdfc3e6c6fc@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=kbrown@cornell.edu \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.