summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:28 (GMT)
commit7c3d15fe3113cf48db60656eedd152c46f47bf6b (patch)
treeafcbf8eb2ae30d903c3649aab8093a8c3a8f4b82 /refs.c
parentb2fd6592943db80ef9bfccbf55d65a39268d76ed (diff)
parentac4896f007a624c12feda866aeb4abe8a1394e39 (diff)
downloadgit-7c3d15fe3113cf48db60656eedd152c46f47bf6b.zip
git-7c3d15fe3113cf48db60656eedd152c46f47bf6b.tar.gz
git-7c3d15fe3113cf48db60656eedd152c46f47bf6b.tar.bz2
Merge branch 'jk/snprintf-truncation'
Avoid unchecked snprintf() to make future code auditing easier. * jk/snprintf-truncation: fmt_with_err: add a comment that truncation is OK shorten_unambiguous_ref: use xsnprintf fsmonitor: use internal argv_array of struct child_process log_write_email_headers: use strbufs http: use strbufs instead of fixed buffers
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index 20fb35d..0eb379f 100644
--- a/refs.c
+++ b/refs.c
@@ -1162,8 +1162,8 @@ char *shorten_unambiguous_ref(const char *refname, int strict)
for (i = 0; i < nr_rules; i++) {
assert(offset < total_len);
scanf_fmts[i] = (char *)&scanf_fmts[nr_rules] + offset;
- offset += snprintf(scanf_fmts[i], total_len - offset,
- ref_rev_parse_rules[i], 2, "%s") + 1;
+ offset += xsnprintf(scanf_fmts[i], total_len - offset,
+ ref_rev_parse_rules[i], 2, "%s") + 1;
}
}