When parsing tags, we skip all unknown fields that appear before the tag message. This skipping is done by using a plain `strstr(buffer, "\n\n")` to search for the two newlines that separate tag fields from tag message. As it is not possible to supply a buffer length to `strstr`, this call may skip over the buffer's end and thus result in an out of bounds read. As `strstr` may return a pointer that is out of bounds, the following computation of `buffer_end - buffer` will overflow and result in an allocation of an invalid length. Fix the issue by using `git__memmem` instead. Add a test that verifies parsing the tag fails not due to the allocation failure but due to the tag having no message.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
blob | Loading commit data... | |
commit | Loading commit data... | |
raw | Loading commit data... | |
tag | Loading commit data... | |
tree | Loading commit data... | |
cache.c | Loading commit data... | |
lookup.c | Loading commit data... | |
lookupbypath.c | Loading commit data... | |
message.c | Loading commit data... | |
peel.c | Loading commit data... | |
shortid.c | Loading commit data... |