apps/s_client.c: harden ldap_ExtendedResponse_parse.
authorAndy Polyakov <appro@openssl.org>
Thu, 2 Mar 2017 15:56:44 +0000 (16:56 +0100)
committerAndy Polyakov <appro@openssl.org>
Sat, 4 Mar 2017 22:16:17 +0000 (23:16 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
apps/s_client.c

index b48c3066a7149dcae68124f972808df803c2a3ae..e180772e7f78d65b6ed483cbf2cc6ac6c2da5c34 100644 (file)
@@ -3091,6 +3091,8 @@ static int ldap_ExtendedResponse_parse(const char *buf, long rem)
         goto end;
     }
 
+    rem = len;  /* ensure that we don't overstep the SEQUENCE */
+
     /* pull MessageID */
     inf = ASN1_get_object(&cur, &len, &tag, &xclass, rem);
     if (inf != V_ASN1_UNIVERSAL || tag != V_ASN1_INTEGER ||