• J
    use sha1_to_hex_r() instead of strcpy · d59f765a
    Jeff King 提交于
    Before sha1_to_hex_r() existed, a simple way to get hex
    sha1 into a buffer was with:
    
      strcpy(buf, sha1_to_hex(sha1));
    
    This isn't wrong (assuming the buf is 41 characters), but it
    makes auditing the code base for bad strcpy() calls harder,
    as these become false positives.
    
    Let's convert them to sha1_to_hex_r(), and likewise for
    some calls to find_unique_abbrev(). While we're here, we'll
    double-check that all of the buffers are correctly sized,
    and use the more obvious GIT_SHA1_HEXSZ constant.
    Signed-off-by: NJeff King <peff@peff.net>
    Signed-off-by: NJunio C Hamano <gitster@pobox.com>
    d59f765a
diff.c 137.6 KB