diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-09-17 12:16:55 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-17 13:21:44 +0900 |
commit | afe2fab72c3151d02314ab5ef3708cd203c499e5 (patch) | |
tree | 30a77122430359e18c462938b8f2188d7e12e109 /diff-lib.c | |
parent | use HOST_NAME_MAX to size buffers for gethostname(2) (diff) | |
download | tgif-afe2fab72c3151d02314ab5ef3708cd203c499e5.tar.xz |
gc: call fscanf() with %<len>s, not %<len>c, when reading hostname
Earlier in this codepath, we (ab)used "%<len>c" to read the hostname
recorded in the lockfile into locking_host[HOST_NAME_MAX + 1] while
substituting <len> with the actual value of HOST_NAME_MAX.
This turns out to be incorrect, as it is an instruction to read
exactly the specified number of bytes. Because we are trying to
read at most that many bytes, we should be using "%<len>s" instead.
Helped-by: A. Wilcox <awilfox@adelielinux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-lib.c')
0 files changed, 0 insertions, 0 deletions