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
This commit is contained in:
4
refs.c
4
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user