diff options
author | Jeff King <peff@peff.net> | 2014-06-19 17:58:10 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-20 10:45:19 -0700 |
commit | 67a31f612830e79fe768ac886ed9ef7eadd8fb10 (patch) | |
tree | 71b4f4ec65f9be778404748baa69736839d6d786 /compat/strtoumax.c | |
parent | imap-send: use skip_prefix instead of using magic numbers (diff) | |
download | tgif-67a31f612830e79fe768ac886ed9ef7eadd8fb10.tar.xz |
http-push: refactor parsing of remote object names
We get loose object names like "objects/??/..." from the
remote side, and need to convert them to their hex
representation.
The code to do so is rather hard to follow, as it uses some
calculated lengths whose origins are hard to understand and
verify (e.g., the path must be exactly 49 characters long.
why? Why doesn't the strcpy overflow obj_hex, which is the
same length as path?).
We can simplify this a bit by using skip_prefix, using standard
40- and 20-character buffers for hex and binary sha1s, and
adding some comments.
We also drop a totally bogus comment that claims strlcpy
cannot be used because "path" is not NUL-terminated. Right
between a call to strlen(path) and strcpy(path).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/strtoumax.c')
0 files changed, 0 insertions, 0 deletions