Skip to content

Commit e1d7747

Browse files
authored
Merge pull request libgit2#5337 from pks-t/pks/smart-pkt-ok-overflow
smart_pkt: fix overflow resulting in OOB read/write of one byte
2 parents 2f6f10b + 8685261 commit e1d7747

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/transports/smart_pkt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static int ok_pkt(git_pkt **out, const char *line, size_t len)
273273
line += 3;
274274
len -= 3;
275275

276-
if (line[len - 1] == '\n')
276+
if (len && line[len - 1] == '\n')
277277
--len;
278278

279279
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, len, 1);

0 commit comments

Comments
 (0)