Unverified Commit e1d7747f by Edward Thomson Committed by GitHub

Merge pull request #5337 from pks-t/pks/smart-pkt-ok-overflow

smart_pkt: fix overflow resulting in OOB read/write of one byte
parents 2f6f10bb 86852613
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment