summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/apps/asn1pars.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/openssl/apps/asn1pars.c')
-rw-r--r--crypto/openssl/apps/asn1pars.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/openssl/apps/asn1pars.c b/crypto/openssl/apps/asn1pars.c
index 8367415..7db40ad 100644
--- a/crypto/openssl/apps/asn1pars.c
+++ b/crypto/openssl/apps/asn1pars.c
@@ -304,7 +304,15 @@ bad:
num=tmplen;
}
- if (length == 0) length=(unsigned int)num;
+ if (offset >= num)
+ {
+ BIO_printf(bio_err, "Error: offset too large\n");
+ goto end;
+ }
+
+ num -= offset;
+
+ if ((length == 0) || ((long)length > num)) length=(unsigned int)num;
if(derout) {
if(BIO_write(derout, str + offset, length) != (int)length) {
BIO_printf(bio_err, "Error writing output\n");
OpenPOWER on IntegriCloud