Add some fixes and workarounds for gcc-11 static analyzer.

Not everything is a real bug (false positive rate is very high here),
but the code is actually more readable.
This commit is contained in:
Milan Broz
2021-05-18 16:19:08 +02:00
parent 351d7fefca
commit 413b484774
4 changed files with 17 additions and 1 deletions

View File

@@ -450,6 +450,8 @@ const char *argon2_error_message(int error_code) {
size_t argon2_encodedlen(uint32_t t_cost, uint32_t m_cost, uint32_t parallelism,
uint32_t saltlen, uint32_t hashlen, argon2_type type) {
if (!argon2_type2string(type, 0))
return 0;
return strlen("$$v=$m=,t=,p=$$") + strlen(argon2_type2string(type, 0)) +
numlen(t_cost) + numlen(m_cost) + numlen(parallelism) +
b64len(saltlen) + b64len(hashlen) + numlen(ARGON2_VERSION_NUMBER) + 1;