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]);
                 ^
```
pull/7792/head
David Garske 2024-07-25 11:52:06 -07:00
parent 3fc7be8e3b
commit 6d39a78dba
1 changed files with 4 additions and 3 deletions

View File

@ -1099,10 +1099,11 @@ static WC_INLINE void ShowX509Ex(WOLFSSL_X509* x509, const char* hdr,
char serialMsg[80];
/* testsuite has multiple threads writing to stdout, get output
message ready to write once */
strLen = sprintf(serialMsg, " %s", words[3]);
* message ready to write once */
strLen = XSNPRINTF(serialMsg, sizeof(serialMsg), " %s", words[3]);
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);
}