Skip to content
  • Jeff King's avatar
    use xsnprintf for generating git object headers · ef1286d3
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    We generally use 32-byte buffers to format git's "type size"
    header fields. These should not generally overflow unless
    you can produce some truly gigantic objects (and our types
    come from our internal array of constant strings). But it is
    a good idea to use xsnprintf to make sure this is the case.
    
    Note that we slightly modify the interface to
    write_sha1_file_prepare, which nows uses "hdrlen" as an "in"
    parameter as well as an "out" (on the way in it stores the
    allocated size of the header, and on the way out it returns
    the ultimate size of the header).
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    ef1286d3