summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/transports/smart_pkt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/transports/smart_pkt.c b/src/transports/smart_pkt.c
index 9bc273e0c..56b680d28 100644
--- a/src/transports/smart_pkt.c
+++ b/src/transports/smart_pkt.c
@@ -273,7 +273,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
line += 3;
len -= 3;
- if (line[len - 1] == '\n')
+ if (len && line[len - 1] == '\n')
--len;
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, len, 1);