aboutsummaryrefslogtreecommitdiffstats
path: root/libar2_decode_params.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-16 23:55:44 +0100
committerMattias Andrée <maandree@kth.se>2022-02-16 23:55:44 +0100
commitd21c35a32fe49d145e1df6df0be1af33a0e16669 (patch)
treec17c9938e668271e4f98c4cfd2671b9ed5b4d5c9 /libar2_decode_params.c
parentStrict parameter order in parameter string (this is what is done in the reference implementation and is the desirable behaviour) (diff)
downloadlibar2-d21c35a32fe49d145e1df6df0be1af33a0e16669.tar.gz
libar2-d21c35a32fe49d145e1df6df0be1af33a0e16669.tar.bz2
libar2-d21c35a32fe49d145e1df6df0be1af33a0e16669.tar.xz
Fix previous commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libar2_decode_params.c')
-rw-r--r--libar2_decode_params.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libar2_decode_params.c b/libar2_decode_params.c
index 1f7d270..86fae6c 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' || !isdigit(s[0])) {
errno = EINVAL;
return 0;
}
@@ -59,6 +59,8 @@ libar2_decode_params(const char *str, struct libar2_argon2_parameters *params, c
goto fail;
if (u32 > (uint_least32_t)INT_MAX)
goto erange;
+ if (!u32)
+ goto einval;
params->version = (enum libar2_argon2_version)u32;
str += n + 2;
if (*str++ != '$')