Skip to content

Commit 983f72c

Browse files
authored
Merge pull request libgit2#4696 from nelhage/git_pkt_ref-check-len
Verify ref_pkt's are long enough
2 parents b121b7a + 437ee5a commit 983f72c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/transports/smart_pkt.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ static int ref_pkt(git_pkt **out, const char *line, size_t len)
216216
git_pkt_ref *pkt;
217217
size_t alloclen;
218218

219+
if (len < GIT_OID_HEXSZ + 1) {
220+
giterr_set(GITERR_NET, "error parsing pkt-line");
221+
return -1;
222+
}
223+
219224
pkt = git__malloc(sizeof(git_pkt_ref));
220225
GITERR_CHECK_ALLOC(pkt);
221226

0 commit comments

Comments
 (0)