diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/asn1/bio_asn1.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libcrypto/asn1/bio_asn1.c b/src/lib/libcrypto/asn1/bio_asn1.c index 6670ef5c17..219810db82 100644 --- a/src/lib/libcrypto/asn1/bio_asn1.c +++ b/src/lib/libcrypto/asn1/bio_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_asn1.c,v 1.10 2014/07/10 13:58:22 jsing Exp $ */ | 1 | /* $OpenBSD: bio_asn1.c,v 1.11 2015/02/10 09:52:35 miod Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project. | 3 | * project. |
4 | */ | 4 | */ |
@@ -200,7 +200,7 @@ static int | |||
200 | asn1_bio_write(BIO *b, const char *in , int inl) | 200 | asn1_bio_write(BIO *b, const char *in , int inl) |
201 | { | 201 | { |
202 | BIO_ASN1_BUF_CTX *ctx; | 202 | BIO_ASN1_BUF_CTX *ctx; |
203 | int wrmax, wrlen, ret; | 203 | int wrmax, wrlen, ret, buflen; |
204 | unsigned char *p; | 204 | unsigned char *p; |
205 | 205 | ||
206 | if (!in || (inl < 0) || (b->next_bio == NULL)) | 206 | if (!in || (inl < 0) || (b->next_bio == NULL)) |
@@ -231,9 +231,10 @@ asn1_bio_write(BIO *b, const char *in , int inl) | |||
231 | break; | 231 | break; |
232 | 232 | ||
233 | case ASN1_STATE_HEADER: | 233 | case ASN1_STATE_HEADER: |
234 | ctx->buflen = | 234 | buflen = ASN1_object_size(0, inl, ctx->asn1_tag) - inl; |
235 | ASN1_object_size(0, inl, ctx->asn1_tag) - inl; | 235 | if (buflen <= 0 || buflen > ctx->bufsize) |
236 | OPENSSL_assert(ctx->buflen <= ctx->bufsize); | 236 | return -1; |
237 | ctx->buflen = buflen; | ||
237 | p = ctx->buf; | 238 | p = ctx->buf; |
238 | ASN1_put_object(&p, 0, inl, | 239 | ASN1_put_object(&p, 0, inl, |
239 | ctx->asn1_tag, ctx->asn1_class); | 240 | ctx->asn1_tag, ctx->asn1_class); |