Commit 21a2318b by Patrick Steinhardt

smart_pkt: do not accept callers passing in no line length

Right now, we simply ignore the `linelen` parameter of
`git_pkt_parse_line` in case the caller passed in zero. But in fact, we
never want to assume anything about the provided buffer length and
always want the caller to pass in the available number of bytes.
And in fact, checking all the callers, one can see that the funciton is
never being called in case where the buffer length is zero, and thus we
are safe to remove this check.

(cherry picked from commit 1bc5b05c)
parent 5836d8b6
......@@ -437,10 +437,10 @@ int git_pkt_parse_line(
}
/*
* If we were given a buffer length, then make sure there is
* enough in the buffer to satisfy this line
* Make sure there is enough in the buffer to satisfy
* this line.
*/
if (linelen > 0 && linelen < (size_t)len)
if (linelen < len)
return GIT_EBUFS;
/*
......
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