summaryrefslogtreecommitdiff
path: root/builtin/name-rev.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-09-24 21:07:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-09-25 17:18:18 (GMT)
commitb7115a350b5c01ce0ae7a8735e4235d4b2367b5f (patch)
treec61ee7939864a8d3a82abcc26fe803851599f0f4 /builtin/name-rev.c
parent0cc41428596ec1cd3862918ef781793ef7346ba5 (diff)
downloadgit-b7115a350b5c01ce0ae7a8735e4235d4b2367b5f.zip
git-b7115a350b5c01ce0ae7a8735e4235d4b2367b5f.tar.gz
git-b7115a350b5c01ce0ae7a8735e4235d4b2367b5f.tar.bz2
receive-pack: convert strncpy to xsnprintf
This strncpy is pointless; we pass the strlen() of the src string, meaning that it works just like a memcpy. Worse, though, is that the size has no relation to the destination buffer, meaning it is a potential overflow. In practice, it's not. We pass only short constant strings like "warning: " and "error: ", which are much smaller than the destination buffer. We can make this much simpler by just using xsnprintf, which will check for overflow and return the size for our next vsnprintf, without us having to run a separate strlen(). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/name-rev.c')
0 files changed, 0 insertions, 0 deletions