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 b48c306..e180772 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 ||