1
0
mirror of https://github.com/ARMmbed/mbedtls.git synced 2025-05-10 00:49:04 +08:00

x509_crt: Removed length_as_int intermediate variable

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis 2023-09-25 14:41:12 +01:00
parent 59108d3f4d
commit a9bb34cd73

View File

@ -1541,7 +1541,6 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
char filename[MAX_PATH];
char *p;
size_t len = strlen(path);
int length_as_int = 0;
WIN32_FIND_DATAW file_data;
HANDLE hFind;
@ -1557,16 +1556,12 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
p = filename + len;
filename[len++] = '*';
if (FAILED(SizeTToInt(len, &length_as_int))) {
return MBEDTLS_ERR_X509_FILE_IO_ERROR;
}
/*
* Note this function uses the code page CP_ACP which is the system default
* ANSI codepage. The input string is always described in BYTES and the
* output length is described in WCHARs.
*/
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, length_as_int, szDir,
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, (int) len, szDir,
MAX_PATH - 3);
if (w_ret == 0) {
return MBEDTLS_ERR_X509_BAD_INPUT_DATA;