mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-05-09 16:41:19 +08:00
Fix coding style of length_as_int var in x509_crt.c
Variable had the very Windows name of lengthAsInt, which is fine for C# but doesn't match the Mbed TLS coding standards. Signed-off-by: Simon Butcher <simon.butcher@arm.com>
This commit is contained in:
parent
949aa8fa3a
commit
de573f56e5
@ -1554,7 +1554,7 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
char *p;
|
char *p;
|
||||||
size_t len = strlen(path);
|
size_t len = strlen(path);
|
||||||
int lengthAsInt = 0;
|
int length_as_int = 0;
|
||||||
|
|
||||||
WIN32_FIND_DATAW file_data;
|
WIN32_FIND_DATAW file_data;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
@ -1570,7 +1570,7 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
p = filename + len;
|
p = filename + len;
|
||||||
filename[len++] = '*';
|
filename[len++] = '*';
|
||||||
|
|
||||||
if (FAILED (SizeTToInt(len, &lengthAsInt)))
|
if (FAILED (SizeTToInt(len, &length_as_int)))
|
||||||
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1581,7 +1581,7 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
* incoming string are less than MAX_PATH to avoid a buffer overrun with
|
* incoming string are less than MAX_PATH to avoid a buffer overrun with
|
||||||
* MultiByteToWideChar().
|
* MultiByteToWideChar().
|
||||||
*/
|
*/
|
||||||
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, (int) len, szDir,
|
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, length_as_int, szDir,
|
||||||
MAX_PATH - 3);
|
MAX_PATH - 3);
|
||||||
if (w_ret == 0) {
|
if (w_ret == 0) {
|
||||||
return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
|
return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
|
||||||
@ -1600,14 +1600,15 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
w_ret = WideCharToMultiByte(CP_ACP, 0, file_data.cFileName,
|
if (FAILED(SizeTToInt(wcslen(file_data.cFileName), &length_as_int)))
|
||||||
-1,
|
|
||||||
p, (int) len,
|
|
||||||
NULL, NULL);
|
|
||||||
if (FAILED(SizeTToInt(wcslen(file_data.cFileName), &lengthAsInt)))
|
|
||||||
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
||||||
|
|
||||||
if (w_ret == 0) {
|
w_ret = WideCharToMultiByte(CP_ACP, 0, file_data.cFileName,
|
||||||
|
length_as_int,
|
||||||
|
p, (int) len - 1,
|
||||||
|
NULL, NULL);
|
||||||
|
if(w_ret == 0)
|
||||||
|
{
|
||||||
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
|
ret = MBEDTLS_ERR_X509_FILE_IO_ERROR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user