emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master a066fb1: Fix use-after-close in connect_network_soc


From: Paul Eggert
Subject: [Emacs-diffs] master a066fb1: Fix use-after-close in connect_network_socket
Date: Thu, 21 Jul 2016 09:29:48 +0000 (UTC)

branch: master
commit a066fb1ceee373c982214c28206108c5fba01bf7
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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)



reply via email to

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