Skip to content

Commit cc5966b

Browse files
authored
Merge pull request libgit2#3983 from pks-t/pks/smart-early-eof
transports: smart: abort on early end of stream
2 parents eb71490 + 62494bf commit cc5966b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

include/git2/proxy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef enum {
1919
/**
2020
* Do not attempt to connect through a proxy
2121
*
22-
* If built against lbicurl, it itself may attempt to connect
22+
* If built against libcurl, it itself may attempt to connect
2323
* to a proxy if the environment variables specify it.
2424
*/
2525
GIT_PROXY_NONE,

src/transports/smart_protocol.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ int git_smart__store_refs(transport_smart *t, int flushes)
5050
if ((recvd = gitno_recv(buf)) < 0)
5151
return recvd;
5252

53-
if (recvd == 0 && !flush) {
53+
if (recvd == 0) {
5454
giterr_set(GITERR_NET, "early EOF");
5555
return GIT_EEOF;
5656
}
@@ -222,8 +222,12 @@ static int recv_pkt(git_pkt **out, gitno_buffer *buf)
222222
if (error < 0 && error != GIT_EBUFS)
223223
return error;
224224

225-
if ((ret = gitno_recv(buf)) < 0)
225+
if ((ret = gitno_recv(buf)) < 0) {
226226
return ret;
227+
} else if (ret == 0) {
228+
giterr_set(GITERR_NET, "early EOF");
229+
return GIT_EEOF;
230+
}
227231
} while (error);
228232

229233
gitno_consume(buf, line_end);

0 commit comments

Comments
 (0)