mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 03:07:29 +02:00
Fix for using sprintf.
Resolves warning: ``` ./configure CC="gcc -fsanitize=address" && make In file included from ./wolfclu/clu_header_main.h:71: /usr/local/include/wolfssl/test.h:1103:18: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations] strLen = sprintf(serialMsg, " %s", words[3]); ^ ```
This commit is contained in:
@ -1099,10 +1099,11 @@ static WC_INLINE void ShowX509Ex(WOLFSSL_X509* x509, const char* hdr,
|
|||||||
char serialMsg[80];
|
char serialMsg[80];
|
||||||
|
|
||||||
/* testsuite has multiple threads writing to stdout, get output
|
/* testsuite has multiple threads writing to stdout, get output
|
||||||
message ready to write once */
|
* message ready to write once */
|
||||||
strLen = sprintf(serialMsg, " %s", words[3]);
|
strLen = XSNPRINTF(serialMsg, sizeof(serialMsg), " %s", words[3]);
|
||||||
for (i = 0; i < sz; i++)
|
for (i = 0; i < sz; i++)
|
||||||
sprintf(serialMsg + strLen + (i*3), ":%02x ", serial[i]);
|
strLen = XSNPRINTF(serialMsg + strLen, sizeof(serialMsg) - strLen,
|
||||||
|
":%02x ", serial[i]);
|
||||||
printf("%s\n", serialMsg);
|
printf("%s\n", serialMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user