Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5252,10 +5252,12 @@ const char* Certificate::ExportChallenge(const char* data, int len) {
if (sp == nullptr)
return nullptr;

const char* buf = nullptr;
buf = reinterpret_cast<const char*>(ASN1_STRING_data(sp->spkac->challenge));
unsigned char* buf = nullptr;
ASN1_STRING_to_UTF8(&buf, sp->spkac->challenge);

return buf;
NETSCAPE_SPKI_free(sp);

return reinterpret_cast<const char*>(buf);
}


Expand All @@ -5282,7 +5284,7 @@ void Certificate::ExportChallenge(const FunctionCallbackInfo<Value>& args) {

Local<Value> outString = Encode(env->isolate(), cert, strlen(cert), BUFFER);

delete[] cert;
OPENSSL_free(const_cast<char*>(cert));

args.GetReturnValue().Set(outString);
}
Expand Down