Skip to content
  • Jeff King's avatar
    notes: use a strbuf in add_non_note · c29edfef
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When we are loading a notes tree into our internal hash
    table, we also collect any files that are clearly non-notes.
    We format the name of the file into a PATH_MAX buffer, but
    unlike true notes (which cannot be larger than a fanned-out
    sha1 hash), these tree entries can be arbitrarily long,
    overflowing our buffer.
    
    We can fix this by switching to a strbuf. It doesn't even
    cost us an extra allocation, as we can simply hand ownership
    of the buffer over to the non-note struct.
    
    This is of moderate security interest, as you might fetch
    notes trees from an untrusted remote. However, we do not do
    so by default, so you would have to manually fetch into the
    notes namespace.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    c29edfef