From 14d6df87025b95e781f55101aaad4c7baec46cea Mon Sep 17 00:00:00 2001 From: Alexis Campailla Date: Sat, 28 Dec 2013 15:12:40 +0700 Subject: [PATCH] node: fix argument parsing with -p arg node -p would cause an access violation. Fixes test\message\stdin_messages.js on Windows. --- src/node.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 47ef87b77f..0b3697d71e 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2867,7 +2867,9 @@ static void ParseArgs(int* argc, fprintf(stderr, "%s: %s requires an argument\n", argv[0], arg); exit(9); } - } else if (argv[index + 1] != NULL && argv[index + 1][0] != '-') { + } else if ((index + 1 < nargs) && + argv[index + 1] != NULL && + argv[index + 1][0] != '-') { args_consumed += 1; eval_string = argv[index + 1]; if (strncmp(eval_string, "\\-", 2) == 0) {