Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1196023

Browse filesBrowse files
tniessendanielleadams
authored andcommitted
src: improve SPKAC::ExportChallenge()
Declare buf as an unsigned char to get rid of the reinterpret_cast and do not ignore the return value of ASN1_STRING_TO_UTF8. This also removes the need to call strlen() on the result. PR-URL: #44002 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 6bf688d commit 1196023
Copy full SHA for 1196023

File tree

Expand file treeCollapse file tree

1 file changed

+3
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-6
lines changed
Open diff view settings
Collapse file

‎src/crypto/crypto_spkac.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_spkac.cc
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,9 @@ ByteSource ExportChallenge(const ArrayBufferOrViewContents<char>& input) {
9999
if (!sp)
100100
return ByteSource();
101101

102-
char* buf = nullptr;
103-
ASN1_STRING_to_UTF8(
104-
reinterpret_cast<unsigned char**>(&buf),
105-
sp->spkac->challenge);
106-
107-
return ByteSource::Allocated(buf, strlen(buf));
102+
unsigned char* buf = nullptr;
103+
int buf_size = ASN1_STRING_to_UTF8(&buf, sp->spkac->challenge);
104+
return (buf_size >= 0) ? ByteSource::Allocated(buf, buf_size) : ByteSource();
108105
}
109106

110107
void ExportChallenge(const FunctionCallbackInfo<Value>& args) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.