Skip to content
  • Jeff King's avatar
    avoid using fixed PATH_MAX buffers for refs · 7f897b6f
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Many functions which handle refs use a PATH_MAX-sized buffer
    to do so. This is mostly reasonable as we have to write
    loose refs into the filesystem, and at least on Linux the 4K
    PATH_MAX is big enough that nobody would care. But:
    
      1. The static PATH_MAX is not always the filesystem limit.
    
      2. On other platforms, PATH_MAX may be much smaller.
    
      3. As we move to alternate ref storage, we won't be bound
         by filesystem limits.
    
    Let's convert these to heap buffers so we don't have to
    worry about truncation or size limits.
    
    We may want to eventually constrain ref lengths for sanity
    and to prevent malicious names, but we should do so
    consistently across all platforms, and in a central place
    (like the ref code).
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    7f897b6f