From 97872aceb6d438617b3b325cd7e0b402f3ae882f Mon Sep 17 00:00:00 2001
From: Paul Bakker
Date: Fri, 2 Nov 2012 12:53:26 +0000
Subject: [PATCH] - Merged 1397 in branch for 1.2
---
library/x509parse.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/library/x509parse.c b/library/x509parse.c
index 843dba7f5..d7bfc05a1 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -1878,7 +1878,7 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
char *p;
int len = strlen( path );
- WIN32_FIND_DATA file_data;
+ WIN32_FIND_DATAW file_data;
HANDLE hFind;
if( len > MAX_PATH - 3 )
@@ -1893,7 +1893,7 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
w_ret = MultiByteToWideChar( CP_ACP, 0, path, len, szDir, MAX_PATH - 3 );
- hFind = FindFirstFile( szDir, &file_data );
+ hFind = FindFirstFileW( szDir, &file_data );
if (hFind == INVALID_HANDLE_VALUE)
return( POLARSSL_ERR_X509_FILE_IO_ERROR );
@@ -1919,7 +1919,7 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
ret += w_ret;
}
- while( FindNextFile( hFind, &file_data ) != 0 );
+ while( FindNextFileW( hFind, &file_data ) != 0 );
if (GetLastError() != ERROR_NO_MORE_FILES)
ret = POLARSSL_ERR_X509_FILE_IO_ERROR;
@@ -1943,7 +1943,10 @@ cleanup:
snprintf( entry_name, sizeof(entry_name), "%s/%s", path, entry->d_name );
t_ret = x509parse_crtfile( chain, entry_name );
if( t_ret < 0 )
- return( t_ret );
+ {
+ ret = t_ret;
+ break;
+ }
ret += t_ret;
}