diff options
author | Gordon Tetlow <gordon@FreeBSD.org> | 2020-12-08 19:10:40 +0000 |
---|---|---|
committer | Gordon Tetlow <gordon@FreeBSD.org> | 2020-12-08 19:10:40 +0000 |
commit | 2120d07af09cb830873554ba5405c5d3e51b41cc (patch) | |
tree | 791263db978a9838d40416cd443c5bc408bd03eb /crypto/openssl/crypto/asn1/tasn_enc.c | |
parent | fc825298b84729facaced36d32c3fc8d111648c1 (diff) | |
download | src-test2-2120d07af09cb830873554ba5405c5d3e51b41cc.tar.gz src-test2-2120d07af09cb830873554ba5405c5d3e51b41cc.zip |
Notes
Diffstat (limited to 'crypto/openssl/crypto/asn1/tasn_enc.c')
-rw-r--r-- | crypto/openssl/crypto/asn1/tasn_enc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/openssl/crypto/asn1/tasn_enc.c b/crypto/openssl/crypto/asn1/tasn_enc.c index d600c7a53804..52a051d5b1c1 100644 --- a/crypto/openssl/crypto/asn1/tasn_enc.c +++ b/crypto/openssl/crypto/asn1/tasn_enc.c @@ -103,9 +103,25 @@ int ASN1_item_ex_i2d(ASN1_VALUE **pval, unsigned char **out, return asn1_i2d_ex_primitive(pval, out, it, tag, aclass); case ASN1_ITYPE_MSTRING: + /* + * It never makes sense for multi-strings to have implicit tagging, so + * if tag != -1, then this looks like an error in the template. + */ + if (tag != -1) { + ASN1err(ASN1_F_ASN1_ITEM_EX_I2D, ASN1_R_BAD_TEMPLATE); + return -1; + } return asn1_i2d_ex_primitive(pval, out, it, -1, aclass); case ASN1_ITYPE_CHOICE: + /* + * It never makes sense for CHOICE types to have implicit tagging, so + * if tag != -1, then this looks like an error in the template. + */ + if (tag != -1) { + ASN1err(ASN1_F_ASN1_ITEM_EX_I2D, ASN1_R_BAD_TEMPLATE); + return -1; + } if (asn1_cb && !asn1_cb(ASN1_OP_I2D_PRE, pval, it, NULL)) return 0; i = asn1_get_choice_selector(pval, it); |