@@ -148,7 +148,7 @@ namespace {
148
148
SetError (" Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue" );
149
149
}
150
150
char bcrypted[_PASSWORD_LEN];
151
- bcrypt (input.c_str (), salt.c_str (), bcrypted);
151
+ bcrypt (input.c_str (), input. length (), salt.c_str (), bcrypted);
152
152
output = std::string (bcrypted);
153
153
}
154
154
@@ -185,7 +185,7 @@ namespace {
185
185
throw Napi::Error::New (env, " Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue" );
186
186
}
187
187
char bcrypted[_PASSWORD_LEN];
188
- bcrypt (data.c_str (), salt.c_str (), bcrypted);
188
+ bcrypt (data.c_str (), data. length (), salt.c_str (), bcrypted);
189
189
return Napi::String::New (env, bcrypted, strlen (bcrypted));
190
190
}
191
191
@@ -206,7 +206,7 @@ namespace {
206
206
void Execute () {
207
207
char bcrypted[_PASSWORD_LEN];
208
208
if (ValidateSalt (encrypted.c_str ())) {
209
- bcrypt (input.c_str (), encrypted.c_str (), bcrypted);
209
+ bcrypt (input.c_str (), input. length (), encrypted.c_str (), bcrypted);
210
210
result = CompareStrings (bcrypted, encrypted.c_str ());
211
211
}
212
212
}
@@ -243,7 +243,7 @@ namespace {
243
243
std::string hash = info[1 ].As <Napi::String>();
244
244
char bcrypted[_PASSWORD_LEN];
245
245
if (ValidateSalt (hash.c_str ())) {
246
- bcrypt (pw.c_str (), hash.c_str (), bcrypted);
246
+ bcrypt (pw.c_str (), pw. length (), hash.c_str (), bcrypted);
247
247
return Napi::Boolean::New (env, CompareStrings (bcrypted, hash.c_str ()));
248
248
} else {
249
249
return Napi::Boolean::New (env, false );
0 commit comments