From 7510b9707eda202f05ebe6df1cb2790bf72150d0 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Wed, 29 Mar 2017 07:36:55 +0200 Subject: [PATCH] test: fix truncation of argv Currently argv_[1] and argv_[2] are getting truncated by one character because of an incorrect addition of one to account for the null character. I only noticed this when working on #12087, but that fix will probably not get included in favor of a JavaScript test so I'm adding this separate commit for it. Refs: https://github.com/nodejs/node/pull/12087 Backport-PR-URL: https://github.com/nodejs/node/pull/18113 PR-URL: https://github.com/nodejs/node/pull/12110 Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock --- test/cctest/node_test_fixture.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index e32e7e6dc6b3ba..5460a26e3764ad 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -34,8 +34,8 @@ struct Argv { snprintf(argv_[0], prog_len, "%s", prog); snprintf(argv_[0] + prog_len, arg1_len, "%s", arg1); snprintf(argv_[0] + prog_len + arg1_len, arg2_len, "%s", arg2); - argv_[1] = argv_[0] + prog_len + 1; - argv_[2] = argv_[0] + prog_len + arg1_len + 1; + argv_[1] = argv_[0] + prog_len; + argv_[2] = argv_[0] + prog_len + arg1_len; } ~Argv() {