Skip to content

Commit

Permalink
test: fix truncation of argv
Browse files Browse the repository at this point in the history
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 nodejs#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: nodejs#12087
  • Loading branch information
danbev committed Mar 29, 2017
1 parent a46c43d commit 32d9f3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/cctest/node_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,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() {
Expand Down

0 comments on commit 32d9f3f

Please sign in to comment.