GithubHelp home page GithubHelp logo

Comments (8)

alexcrichton avatar alexcrichton commented on May 29, 2024

Oh dear I had no idea!

from git2-rs.

joshtriplett avatar joshtriplett commented on May 29, 2024

Investigating more carefully, it looks like libgit2 might handle the length automatically, at least in git_index_add. But it's still not safe to expose path directly, because it must be NUL-terminated.

from git2-rs.

alexcrichton avatar alexcrichton commented on May 29, 2024

Yeah this sounds pretty bad all around, and IndexEntry may end up just needing a complete overhaul

from git2-rs.

joshtriplett avatar joshtriplett commented on May 29, 2024

A related issue I just ran into: if you read an IndexEntry using git2::Index::get_path, and then add that entry to another index using .git2::Index::add, that can read off the end of the .path field. Whatever safety property .add needs, the IndexEntry returned by .get_path doesn't seem to satisfy.

from git2-rs.

alexcrichton avatar alexcrichton commented on May 29, 2024

Oh dear, this appears to be extra bad then! Thanks for the reports!

Ah and I am indeed acrichto on IRC, sorry I missed your ping! I probably won't be able to get around to this until perhaps this weekend at the earliest, but if you want to try to tackle it ahead of time feel free as well!

from git2-rs.

alexcrichton avatar alexcrichton commented on May 29, 2024

Ok, can you try giving master a spin? If it works I'll publish a release

from git2-rs.

joshtriplett avatar joshtriplett commented on May 29, 2024

@alexcrichton Seems to work; I removed the workarounds I had for NUL handling, and everything seems functional.

I made one comment on the commit, regarding whether IndexEntry should have a Path instead of a Vec<u8> to make it explicit that it shouldn't have NUL handling. Otherwise, this looks good to me.

from git2-rs.

alexcrichton avatar alexcrichton commented on May 29, 2024

Ok, thanks for checking!

from git2-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.