From 859d7be6dbd4f0ae9f97ad3c3bac08dd48e8d730 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Fri, 12 May 2017 12:47:47 -0700 Subject: [PATCH] src: fix --abort_on_uncaught_exception arg parsing Fix c0bde73f, which inadvertently introduced a use of strcmp() without correctly comparing its return to zero. Caught by coverity: >>> CID 169223: Integer handling issues (CONSTANT_EXPRESSION_RESULT) >>> The "or" condition "strcmp(arg, "--abort-on-uncaught-exception") || strcmp(arg, "--abort_on_uncaught_exception")" will always be true because "arg" cannot be equal to two different values at the same time, so it must be not equal to at least one of them. 3909 } else if (strcmp(arg, "--abort-on-uncaught-exception") || 3910 strcmp(arg, "--abort_on_uncaught_exception")) { 3911 abort_on_uncaught_exception = true; 3912 // Also a V8 option. Pass through as-is. 3913 new_v8_argv[new_v8_argc] = arg; 3914 new_v8_argc += 1; PR-URL: https://github.com/nodejs/node/pull/13004 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: Richard Lau --- src/node.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index f943d75a575595..8ad742b0c1f561 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3906,8 +3906,8 @@ static void ParseArgs(int* argc, } else if (strcmp(arg, "--") == 0) { index += 1; break; - } else if (strcmp(arg, "--abort-on-uncaught-exception") || - strcmp(arg, "--abort_on_uncaught_exception")) { + } else if (strcmp(arg, "--abort-on-uncaught-exception") == 0 || + strcmp(arg, "--abort_on_uncaught_exception") == 0) { abort_on_uncaught_exception = true; // Also a V8 option. Pass through as-is. new_v8_argv[new_v8_argc] = arg;