Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Core
Tor
Commits
9b2a0f5c
Commit
9b2a0f5c
authored
11 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/maint-0.2.4'
parents
5c9008e0
a8e76de4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changes/bug9400
+7
-0
7 additions, 0 deletions
changes/bug9400
src/common/compat.c
+7
-7
7 additions, 7 deletions
src/common/compat.c
with
14 additions
and
7 deletions
changes/bug9400
0 → 100644
+
7
−
0
View file @
9b2a0f5c
o Minor bugfixes:
- Avoid double-closing the listener socket in our socketpair replacement
(used on Windows) in the case where the addresses on our opened
sockets don't match what we expected. Fixes bug 9400; bugfix on
every released Tor version. Found by Coverity.
This diff is collapsed.
Click to expand it.
src/common/compat.c
+
7
−
7
View file @
9b2a0f5c
...
...
@@ -1313,9 +1313,9 @@ tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
* for now, and really, when localhost is down sometimes, we
* have other problems too.
*/
tor_socket_t
listener
=
-
1
;
tor_socket_t
connector
=
-
1
;
tor_socket_t
acceptor
=
-
1
;
tor_socket_t
listener
=
TOR_INVALID_SOCKET
;
tor_socket_t
connector
=
TOR_INVALID_SOCKET
;
tor_socket_t
acceptor
=
TOR_INVALID_SOCKET
;
struct
sockaddr_in
listen_addr
;
struct
sockaddr_in
connect_addr
;
socklen_t
size
;
...
...
@@ -1369,7 +1369,6 @@ tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
goto
tidy_up_and_fail
;
if
(
size
!=
sizeof
(
listen_addr
))
goto
abort_tidy_up_and_fail
;
tor_close_socket
(
listener
);
/* Now check we are talking to ourself by matching port and host on the
two sockets. */
if
(
getsockname
(
connector
,
(
struct
sockaddr
*
)
&
connect_addr
,
&
size
)
==
-
1
)
...
...
@@ -1380,6 +1379,7 @@ tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
||
listen_addr
.
sin_port
!=
connect_addr
.
sin_port
)
{
goto
abort_tidy_up_and_fail
;
}
tor_close_socket
(
listener
);
fd
[
0
]
=
connector
;
fd
[
1
]
=
acceptor
;
...
...
@@ -1394,11 +1394,11 @@ tor_ersatz_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
tidy_up_and_fail:
if
(
saved_errno
<
0
)
saved_errno
=
errno
;
if
(
listener
!=
-
1
)
if
(
SOCKET_OK
(
listener
)
)
tor_close_socket
(
listener
);
if
(
connector
!=
-
1
)
if
(
SOCKET_OK
(
connector
)
)
tor_close_socket
(
connector
);
if
(
acceptor
!=
-
1
)
if
(
SOCKET_OK
(
acceptor
)
)
tor_close_socket
(
acceptor
);
return
-
saved_errno
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment