summaryrefslogtreecommitdiff
path: root/fsmonitor.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 /fsmonitor.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 'fsmonitor.c')
-rw-r--r--fsmonitor.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/fsmonitor.c b/fsmonitor.c
index ed3d1a0..665bd2d 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -97,19 +97,13 @@ void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
static int query_fsmonitor(int version, uint64_t last_update, struct strbuf *query_result)
{
struct child_process cp = CHILD_PROCESS_INIT;
- char ver[64];
- char date[64];
- const char *argv[4];
- if (!(argv[0] = core_fsmonitor))
+ if (!core_fsmonitor)
return -1;
- snprintf(ver, sizeof(ver), "%d", version);
- snprintf(date, sizeof(date), "%" PRIuMAX, (uintmax_t)last_update);
- argv[1] = ver;
- argv[2] = date;
- argv[3] = NULL;
- cp.argv = argv;
+ argv_array_push(&cp.args, core_fsmonitor);
+ argv_array_pushf(&cp.args, "%d", version);
+ argv_array_pushf(&cp.args, "%" PRIuMAX, (uintmax_t)last_update);
cp.use_shell = 1;
cp.dir = get_git_work_tree();