summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/x_x509.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/x_x509.c')
-rw-r--r--src/lib/libcrypto/asn1/x_x509.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/lib/libcrypto/asn1/x_x509.c b/src/lib/libcrypto/asn1/x_x509.c
index 70d38221b6..168c2c0fcd 100644
--- a/src/lib/libcrypto/asn1/x_x509.c
+++ b/src/lib/libcrypto/asn1/x_x509.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x_x509.c,v 1.23 2015/02/11 04:00:39 jsing Exp $ */ 1/* $OpenBSD: x_x509.c,v 1.24 2015/03/19 14:00:22 tedu Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -313,16 +313,20 @@ d2i_X509_AUX(X509 **a, const unsigned char **pp, long length)
313 313
314 /* Save start position */ 314 /* Save start position */
315 q = *pp; 315 q = *pp;
316 ret = d2i_X509(a, pp, length); 316 ret = d2i_X509(NULL, pp, length);
317 /* If certificate unreadable then forget it */ 317 /* If certificate unreadable then forget it */
318 if (!ret) 318 if (!ret)
319 return NULL; 319 return NULL;
320 /* update length */ 320 /* update length */
321 length -= *pp - q; 321 length -= *pp - q;
322 if (!length) 322 if (length > 0) {
323 return ret; 323 if (!d2i_X509_CERT_AUX(&ret->aux, pp, length))
324 if (!d2i_X509_CERT_AUX(&ret->aux, pp, length)) 324 goto err;
325 goto err; 325 }
326 if (a != NULL) {
327 X509_free(*a);
328 *a = ret;
329 }
326 return ret; 330 return ret;
327 331
328err: 332err: