Merge pull request #5219 from douzzer/20220607-strlcpy

use XSTRLCPY() and XSTRLCAT() in EncryptDerKey()
This commit is contained in:
David Garske
2022-06-07 09:34:40 -07:00
committed by GitHub
2 changed files with 2 additions and 3 deletions

View File

@@ -26895,8 +26895,8 @@ int EncryptDerKey(byte *der, int *derSz, const EVP_CIPHER* cipher,
#endif #endif
return WOLFSSL_FAILURE; return WOLFSSL_FAILURE;
} }
XSTRCPY((char*)*cipherInfo, info->name); XSTRLCPY((char*)*cipherInfo, info->name, cipherInfoSz);
XSTRNCAT((char*)*cipherInfo, ",", 2); XSTRLCAT((char*)*cipherInfo, ",", cipherInfoSz);
idx = (word32)XSTRLEN((char*)*cipherInfo); idx = (word32)XSTRLEN((char*)*cipherInfo);
cipherInfoSz -= idx; cipherInfoSz -= idx;

View File

@@ -616,7 +616,6 @@ decouple library dependencies with standard string, memory and so on.
#define XSTRLEN(s1) strlen((s1)) #define XSTRLEN(s1) strlen((s1))
#define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n)) #define XSTRNCPY(s1,s2,n) strncpy((s1),(s2),(n))
#define XSTRCPY(s1,s2) strcpy((s1),(s2))
/* strstr, strncmp, strcmp, and strncat only used by wolfSSL proper, /* strstr, strncmp, strcmp, and strncat only used by wolfSSL proper,
* not required for wolfCrypt only */ * not required for wolfCrypt only */
#define XSTRSTR(s1,s2) strstr((s1),(s2)) #define XSTRSTR(s1,s2) strstr((s1),(s2))