Avoid creating an illegal pointer.
authorKurt Roeckx <kurt@roeckx.be>
Sat, 4 Jun 2016 17:52:28 +0000 (19:52 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Sat, 11 Jun 2016 14:43:48 +0000 (16:43 +0200)
Found by tis-interpreter

Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #1166

crypto/asn1/asn1_par.c

index 51da014..1e17895 100644 (file)
@@ -86,8 +86,7 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length,
     dump_indent = 6;            /* Because we know BIO_dump_indent() */
     p = *pp;
     tot = p + length;
-    op = p - 1;
-    while ((p < tot) && (op < p)) {
+    while (length > 0) {
         op = p;
         j = ASN1_get_object(&p, &len, &tag, &xclass, length);
         if (j & 0x80) {