Fix unchecked error on windows
diff --git a/ChangeLog b/ChangeLog
index a6a4bc3..b13d757 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,9 +20,10 @@
* Fix memory leaks in PKCS#5 and PKCS#12.
* Stack buffer overflow if ctr_drbg_update() is called with too large
add_len (found by Jean-Philippe Aumasson) (not triggerable remotely).
- * Fix bug in MPI/bugnum on s390/s390x (reported by Dan Horák) (introduced
+ * Fix bug in MPI/bignum on s390/s390x (reported by Dan Horák) (introduced
in 1.2.12).
-
+ * Fix unchecked return code in x509_crt_parse_path() on Windows (found by
+ Peter Vaskovic).
Changes
* Blind RSA private operations even when POLARSSL_RSA_NO_CRT is defined.
diff --git a/library/x509parse.c b/library/x509parse.c
index fff6dd6..ea59bec 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -1949,6 +1949,8 @@
filename[len++] = '*';
w_ret = MultiByteToWideChar( CP_ACP, 0, filename, len, szDir, MAX_PATH - 3 );
+ if( w_ret == 0 )
+ return( POLARSSL_ERR_X509_INVALID_INPUT );
hFind = FindFirstFileW( szDir, &file_data );
if (hFind == INVALID_HANDLE_VALUE)
@@ -1966,6 +1968,8 @@
lstrlenW(file_data.cFileName),
p, len - 1,
NULL, NULL );
+ if( w_ret == 0 )
+ return( POLARSSL_ERR_X509_FILE_IO_ERROR );
w_ret = x509parse_crtfile( chain, filename );
if( w_ret < 0 )