summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-11-14 10:39:45 +0100
committerGitHub <noreply@github.com>2016-11-14 10:39:45 +0100
commitcc5966b071b37c38736ce8ad526e612d0703b523 (patch)
tree3261366b4057dd32a40604f25a24cf7ae582a29a
parenteb71490ac2c4a4f81d2a04fdd411b7d62d16b8fb (diff)
parent62494bf234919e04a6e145d59942d2a05c96ae0d (diff)
downloadlibgit2-cc5966b071b37c38736ce8ad526e612d0703b523.tar.gz
Merge pull request #3983 from pks-t/pks/smart-early-eof
transports: smart: abort on early end of stream
-rw-r--r--include/git2/proxy.h2
-rw-r--r--src/transports/smart_protocol.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/include/git2/proxy.h b/include/git2/proxy.h
index dcd615633..194cbb651 100644
--- a/include/git2/proxy.h
+++ b/include/git2/proxy.h
@@ -19,7 +19,7 @@ typedef enum {
/**
* Do not attempt to connect through a proxy
*
- * If built against lbicurl, it itself may attempt to connect
+ * If built against libcurl, it itself may attempt to connect
* to a proxy if the environment variables specify it.
*/
GIT_PROXY_NONE,
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 3448fa7fb..c1e412436 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -50,7 +50,7 @@ int git_smart__store_refs(transport_smart *t, int flushes)
if ((recvd = gitno_recv(buf)) < 0)
return recvd;
- if (recvd == 0 && !flush) {
+ if (recvd == 0) {
giterr_set(GITERR_NET, "early EOF");
return GIT_EEOF;
}
@@ -222,8 +222,12 @@ static int recv_pkt(git_pkt **out, gitno_buffer *buf)
if (error < 0 && error != GIT_EBUFS)
return error;
- if ((ret = gitno_recv(buf)) < 0)
+ if ((ret = gitno_recv(buf)) < 0) {
return ret;
+ } else if (ret == 0) {
+ giterr_set(GITERR_NET, "early EOF");
+ return GIT_EEOF;
+ }
} while (error);
gitno_consume(buf, line_end);