Skip to content

Commit

Permalink
Fix NETSCAPE_SPKI_print function to not assume NUL terminated strings
Browse files Browse the repository at this point in the history
ASN.1 strings may not be NUL terminated. Don't assume they are.

CVE-2021-3712

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
  • Loading branch information
mattcaswell committed Aug 24, 2021
1 parent bb4d2ed commit 2d0e5d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/asn1/t_spki.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki)
}
chal = spki->spkac->challenge;
if (chal->length)
BIO_printf(out, " Challenge String: %s\n", chal->data);
BIO_printf(out, " Challenge String: %.*s\n", chal->length, chal->data);
i = OBJ_obj2nid(spki->sig_algor.algorithm);
BIO_printf(out, " Signature Algorithm: %s",
(i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i));
Expand Down

0 comments on commit 2d0e5d4

Please sign in to comment.