Skip to content

Commit

Permalink
x509asn1: return error on missing OID
Browse files Browse the repository at this point in the history
to avoid crash when dereferencing a NULL pointer.

Reported-by: Trzik on github
Patch-by: Trzik on github
Fixes #13684
Closes #13685
  • Loading branch information
bagder committed May 17, 2024
1 parent 6d1e144 commit 13ca438
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/vtls/x509asn1.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ static const struct Curl_OID OIDtable[] = {
{ "2.16.840.1.101.3.4.2.1", "sha256" },
{ "2.16.840.1.101.3.4.2.2", "sha384" },
{ "2.16.840.1.101.3.4.2.3", "sha512" },
{ "1.2.840.113549.1.9.2", "unstructuredName" },
{ (const char *) NULL, (const char *) NULL }
};

Expand Down Expand Up @@ -467,6 +468,8 @@ static CURLcode OID2str(struct dynbuf *store,
const struct Curl_OID *op = searchOID(Curl_dyn_ptr(&buf));
if(op)
result = Curl_dyn_add(store, op->textoid);
else
result = CURLE_BAD_FUNCTION_ARGUMENT;
Curl_dyn_free(&buf);
}
}
Expand Down

0 comments on commit 13ca438

Please sign in to comment.