mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-25 00:55:37 +00:00
Correct fix for potential truncation
This was a false positive caused by the compiler seeing the %08lx specifiers and judging the output on that, rather than the numbers being fed in. Given these are going to be maximum 32 bit numbers, then better to use %08x, which keeps -Wformat-truncation=2 happy as well. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
f8d733e49a
commit
3a5a107fa7
|
@ -47,11 +47,10 @@
|
||||||
#define PSA_ITS_STORAGE_PREFIX ""
|
#define PSA_ITS_STORAGE_PREFIX ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PSA_ITS_STORAGE_FILENAME_PATTERN "%08lx%08lx"
|
#define PSA_ITS_STORAGE_FILENAME_PATTERN "%08x%08x"
|
||||||
#define PSA_ITS_STORAGE_SUFFIX ".psa_its"
|
#define PSA_ITS_STORAGE_SUFFIX ".psa_its"
|
||||||
#define PSA_ITS_STORAGE_FILENAME_LENGTH \
|
#define PSA_ITS_STORAGE_FILENAME_LENGTH \
|
||||||
( sizeof( PSA_ITS_STORAGE_PREFIX ) - 1 + /*prefix without terminating 0*/ \
|
( sizeof( PSA_ITS_STORAGE_PREFIX ) - 1 + /*prefix without terminating 0*/ \
|
||||||
16 + /*UID (64-bit number in hex)*/ \
|
|
||||||
16 + /*UID (64-bit number in hex)*/ \
|
16 + /*UID (64-bit number in hex)*/ \
|
||||||
sizeof( PSA_ITS_STORAGE_SUFFIX ) - 1 + /*suffix without terminating 0*/ \
|
sizeof( PSA_ITS_STORAGE_SUFFIX ) - 1 + /*suffix without terminating 0*/ \
|
||||||
1 /*terminating null byte*/ )
|
1 /*terminating null byte*/ )
|
||||||
|
@ -88,8 +87,8 @@ static void psa_its_fill_filename( psa_storage_uid_t uid, char *filename )
|
||||||
mbedtls_snprintf( filename, PSA_ITS_STORAGE_FILENAME_LENGTH,
|
mbedtls_snprintf( filename, PSA_ITS_STORAGE_FILENAME_LENGTH,
|
||||||
"%s" PSA_ITS_STORAGE_FILENAME_PATTERN "%s",
|
"%s" PSA_ITS_STORAGE_FILENAME_PATTERN "%s",
|
||||||
PSA_ITS_STORAGE_PREFIX,
|
PSA_ITS_STORAGE_PREFIX,
|
||||||
(unsigned long) ( uid >> 32 ),
|
(unsigned) ( uid >> 32 ),
|
||||||
(unsigned long) ( uid & 0xffffffff ),
|
(unsigned) ( uid & 0xffffffff ),
|
||||||
PSA_ITS_STORAGE_SUFFIX );
|
PSA_ITS_STORAGE_SUFFIX );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue