diff options
-rw-r--r-- | libar2_decode_params.c | 2 | ||||
-rw-r--r-- | test.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libar2_decode_params.c b/libar2_decode_params.c index 7707ce4..c42a937 100644 --- a/libar2_decode_params.c +++ b/libar2_decode_params.c @@ -8,7 +8,7 @@ decode_u32(const char *s, uint_least32_t *outp) uint_least32_t digit; size_t i; - if ((s[0] == '0' && s[1] == '0') || !isdigit(s[0])) { + if ((s[0] == '0' && s[1] != '0') || !isdigit(s[0])) { errno = EINVAL; return 0; } @@ -1123,6 +1123,11 @@ check_failures(void) CHECK("$argon2id$m=128,t=128,p=128$AAAABBBBCCCC"); CHECK("$argon2id$m=128,t=128,p=128$AAAAB-BBCCCC$"); CHECK("$argon2id$m=128,t=128,p=128$AAAABBBBC$"); + CHECK("$argon2id$m=0128,t=128,p=128$AAAABBBBCCCC$"); + CHECK("$argon2id$m=128,t=0128,p=128$AAAABBBBCCCC$"); + CHECK("$argon2id$m=128,t=128,p=0128$AAAABBBBCCCC$"); + CHECK("$argon2id$v=0$m=128,t=128,p=128$AAAABBBBCCCC$"); + CHECK("$argon2id$v=016$m=128,t=128,p=128$AAAABBBBCCCC$"); errno = 0; ctx_st.user_data = &user_data; user_data.allocate_fail_in = 1; |