mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-05-09 16:41:19 +08:00
Add clarifying comment on use of MultiByteToWideChar() and CP_ACP
Signed-off-by: Simon Butcher <simon.butcher@arm.com>
This commit is contained in:
parent
bcb6cfb13d
commit
35e5dad865
@ -1573,6 +1573,14 @@ int mbedtls_x509_crt_parse_path(mbedtls_x509_crt *chain, const char *path)
|
|||||||
if (FAILED (SizeTToInt(len, &lengthAsInt)))
|
if (FAILED (SizeTToInt(len, &lengthAsInt)))
|
||||||
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
return(MBEDTLS_ERR_X509_FILE_IO_ERROR);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note this function uses the code page CP_ACP, and assumes the incoming
|
||||||
|
* string is encoded in ANSI, before translating it into Unicode. If the
|
||||||
|
* incoming string were changed to be UTF-8, then the length check needs to
|
||||||
|
* change to check the number of characters, not the number of bytes, in the
|
||||||
|
* incoming string are less than MAX_PATH to avoid a buffer overrun with
|
||||||
|
* MultiByteToWideChar().
|
||||||
|
*/
|
||||||
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, (int) len, szDir,
|
w_ret = MultiByteToWideChar(CP_ACP, 0, filename, (int) len, szDir,
|
||||||
MAX_PATH - 3);
|
MAX_PATH - 3);
|
||||||
if (w_ret == 0) {
|
if (w_ret == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user