From 29debf3ad7d052427541503d871d6c69ed8588a7 Mon Sep 17 00:00:00 2001 From: mtgto Date: Fri, 3 Jul 2020 00:28:08 +0900 Subject: [PATCH] bug: bad comparison of c string (#1347) --- package.json | 2 +- src/statement.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index dfc390136..0e9858259 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "peerDependenciesMeta": { "node-gyp": { - "optional": true + "optional": true } }, "optionalDependencies": { diff --git a/src/statement.cc b/src/statement.cc index 15d6f91a1..fce3f43d8 100644 --- a/src/statement.cc +++ b/src/statement.cc @@ -31,10 +31,10 @@ Napi::Object Statement::Init(Napi::Env env, Napi::Object exports) { } // A Napi InstanceOf for Javascript Objects "Date" and "RegExp" -bool OtherInstanceOf(Napi::Object source, char* object_type) { - if (object_type == "Date") { +bool OtherInstanceOf(Napi::Object source, const char* object_type) { + if (strncmp(object_type, "Date", 4) == 0) { return source.InstanceOf(source.Env().Global().Get("Date").As()); - } else if (object_type == "RegExp") { + } else if (strncmp(object_type, "RegExp", 6) == 0) { return source.InstanceOf(source.Env().Global().Get("RegExp").As()); }