commit 406d5a24d29a81e1741aed65acc1f1000c44f0d3 from: Omar Polo via: Thomas Adam date: Tue Aug 16 13:20:41 2022 UTC convert two snprintf to strlcpy "looks good to me" millert@ commit - 7e1f3a3d0f07de14dd5caeb7dd7b3a802afe3723 commit + 406d5a24d29a81e1741aed65acc1f1000c44f0d3 blob - 301acad04d464fe444ef5e00ae215324d45534ca blob + e493381e3c08c6bb2810e9918907406182ed318d --- libexec/got-fetch-pack/got-fetch-pack.c +++ libexec/got-fetch-pack/got-fetch-pack.c @@ -550,7 +550,7 @@ fetch_pack(int fd, int packfd, uint8_t *pack_sha1, acked++; } - n = snprintf(buf, sizeof(buf), "done\n"); + n = strlcpy(buf, "done\n", sizeof(buf)); err = got_pkt_writepkt(fd, buf, n, chattygot); if (err) goto done; blob - adfe82430669c44becf66e60542e2a069102d0d6 blob + c400c28786bbce149b2ff26efb3230c03908d0f0 --- libexec/got-index-pack/got-index-pack.c +++ libexec/got-index-pack/got-index-pack.c @@ -904,12 +904,10 @@ index_pack(struct got_pack *pack, int idxfd, FILE *tmp } if (pass++ > 3 && n == 0) { - static char msg[64]; - snprintf(msg, sizeof(msg), "could not resolve " - "any of deltas; packfile could be corrupt"); - err = got_error_msg(GOT_ERR_BAD_PACKFILE, msg); + err = got_error_msg(GOT_ERR_BAD_PACKFILE, + "could not resolve any of deltas; packfile could " + "be corrupt"); goto done; - } nresolved += n; nvalid += nresolved;