http-push: replace strcat with xsnprintf
authorJeff King <peff@peff.net>
Thu, 24 Sep 2015 21:06:58 +0000 (17:06 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Sep 2015 17:18:18 +0000 (10:18 -0700)
commit0cc41428596ec1cd3862918ef781793ef7346ba5
treee24056a8c9430b9d9f58dc4e416931a00c396cf9
parent48bcc1c3cc09db1a6da0ce47460fae6e5f7edd4b
http-push: replace strcat with xsnprintf

We account for these strcats in our initial allocation, but
the code is confusing to follow and verify. Let's remember
our original allocation length, and then xsnprintf can
verify that we don't exceed it.

Note that we can't just use xstrfmt here (which would be
even cleaner) because the code tries to grow the buffer only
when necessary.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c