Skip to content

Commit 29debf3

Browse files
authored
bug: bad comparison of c string (#1347)
1 parent be71925 commit 29debf3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
},
5555
"peerDependenciesMeta": {
5656
"node-gyp": {
57-
"optional": true
57+
"optional": true
5858
}
5959
},
6060
"optionalDependencies": {

src/statement.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ Napi::Object Statement::Init(Napi::Env env, Napi::Object exports) {
3131
}
3232

3333
// A Napi InstanceOf for Javascript Objects "Date" and "RegExp"
34-
bool OtherInstanceOf(Napi::Object source, char* object_type) {
35-
if (object_type == "Date") {
34+
bool OtherInstanceOf(Napi::Object source, const char* object_type) {
35+
if (strncmp(object_type, "Date", 4) == 0) {
3636
return source.InstanceOf(source.Env().Global().Get("Date").As<Function>());
37-
} else if (object_type == "RegExp") {
37+
} else if (strncmp(object_type, "RegExp", 6) == 0) {
3838
return source.InstanceOf(source.Env().Global().Get("RegExp").As<Function>());
3939
}
4040

0 commit comments

Comments
 (0)