Skip to content

Commit b782205

Browse files
committed
Merge pull request libgit2#3993 from alexcrichton/fix-fault
2 parents 5fe5557 + 5ca75fd commit b782205

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/curl_stream.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ static int curls_connect(git_stream *stream)
121121
return seterr_curl(s);
122122
}
123123

124+
if (sockextr == -1) {
125+
giterr_set(GITERR_NET, "curl socket is no longer valid");
126+
return -1;
127+
}
128+
124129
s->socket = sockextr;
125130

126131
if (s->parent.encrypted && failed_cert)
@@ -198,6 +203,7 @@ static int wait_for(curl_socket_t fd, bool reading)
198203
FD_ZERO(&outfd);
199204
FD_ZERO(&errfd);
200205

206+
assert(fd >= 0);
201207
FD_SET(fd, &errfd);
202208
if (reading)
203209
FD_SET(fd, &infd);

0 commit comments

Comments
 (0)