all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: emacs-devel@gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: [Emacs-diffs] master a066fb1: Fix use-after-close in connect_network_socket
Date: Mon, 1 Aug 2016 07:43:01 -0400	[thread overview]
Message-ID: <de8ff1ff-f01c-0cce-36ae-8882a02bea00@cornell.edu> (raw)
In-Reply-To: <20160721092948.D1106220159@vcs.savannah.gnu.org>

On 7/21/2016 5:29 AM, Paul Eggert wrote:
> branch: master
> commit a066fb1ceee373c982214c28206108c5fba01bf7
> Author: Paul Eggert <eggert@cs.ucla.edu>
> Commit: Paul Eggert <eggert@cs.ucla.edu>
>
>     Fix use-after-close in connect_network_socket
>
>     * src/process.c (connect_network_socket): Don’t use
>     external_sock_fd after closing it.  Problem found by Coverity Scan.
> ---
>  src/process.c |    4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/process.c b/src/process.c
> index bdbdefa..bc2ac45 100644
> --- a/src/process.c
> +++ b/src/process.c
> @@ -3185,6 +3185,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
>  	      xerrno = errno;
>  	      emacs_close (s);
>  	      s = -1;
> +	      if (socket_to_use < 0)
> +		break;
>  	      continue;
>  	    }
>  	}
> @@ -3312,6 +3314,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object addrinfos,
>        specpdl_ptr = specpdl + count1;
>        emacs_close (s);
>        s = -1;
> +      if (socket_to_use < 0)
> +	break;
>
>  #ifdef WINDOWSNT
>        if (xerrno == EINTR)

This commit causes two network-streams-tests failures on Cygwin:

    FAILED  echo-server-with-dns
    FAILED  echo-server-with-localhost

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.

Ken



       reply	other threads:[~2016-08-01 11:43 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   ` Ken Brown [this message]
2016-08-02  7:32     ` [Emacs-diffs] master a066fb1: Fix use-after-close in connect_network_socket Paul Eggert

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=de8ff1ff-f01c-0cce-36ae-8882a02bea00@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=eggert@cs.ucla.edu \
    --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 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.