From e9581d66b0baafbd2699fea658e7466dd201d8b7 Mon Sep 17 00:00:00 2001 From: Paul Bakker Date: Sat, 28 Mar 2009 20:29:25 +0000 Subject: [PATCH] - Fixed logic error on end of 'full' chain --- library/x509parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/x509parse.c b/library/x509parse.c index 25965595a..919be65d1 100644 --- a/library/x509parse.c +++ b/library/x509parse.c @@ -663,13 +663,13 @@ int x509parse_crt( x509_cert *chain, unsigned char *buf, int buflen ) if( crt == NULL || buf == NULL ) return( 1 ); - while( crt->version != 0 || crt->next != NULL ) + while( crt->version != 0 && crt->next != NULL ) crt = crt->next; /* * Add new certificate on the end of the chain if needed. */ - if ( crt->next == NULL) + if ( crt->version != 0 && crt->next == NULL) { crt->next = (x509_cert *) malloc( sizeof( x509_cert ) );