Skip to content
  • Jeff King's avatar
    convert unchecked snprintf into xsnprintf · 1a168e5c
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    These calls to snprintf should always succeed, because their
    input is small and fixed. Let's use xsnprintf to make sure
    this is the case (and to make auditing for actual truncation
    easier).
    
    These could be candidates for turning into heap buffers, but
    they fall into a few broad categories that make it not worth
    doing:
    
      - formatting single numbers is simple enough that we can
        see the result should fit
    
      - the size of a sha1 is likewise well-known, and I didn't
        want to cause unnecessary conflicts with the ongoing
        process to convert these constants to GIT_MAX_HEXSZ
    
      - the interface for curl_errorstr is dictated by curl
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    1a168e5c