• Show log

    Commit

  • Hash : 608cb07d
    Author : Patrick Steinhardt
    Date : 2019-10-19T16:48:11

    patch_parse: fix out-of-bounds read with No-NL lines
    
    We've got two locations where we copy lines into the patch. The first
    one is when copying normal " ", "-" or "+" lines, while the second
    location gets executed when we copy "\ No newline at end of file" lines.
    While the first one correctly uses `git__strndup` to copy only until the
    newline, the other one doesn't. Thus, if the line occurs at the end of
    the patch and if there is no terminating NUL character, then it may
    result in an out-of-bounds read.
    
    Fix the issue by using `git__strndup`, as was already done in the other
    location. Furthermore, add allocation checks to both locations to detect
    out-of-memory situations.
    

  • README.md

  • Writing Clar tests for libgit2

    For information on the Clar testing framework and a detailed introduction please visit:

    https://github.com/vmg/clar

    • Write your modules and tests. Use good, meaningful names.

    • Make sure you actually build the tests by setting:

        cmake -DBUILD_CLAR=ON build/
    • Test:

        ./build/libgit2_clar
    • Make sure everything is fine.

    • Send your pull request. That’s it.