diff options
| author | abs <abs@NetBSD.org> | 2022-05-29 10:58:09 +0000 |
|---|---|---|
| committer | abs <abs@NetBSD.org> | 2022-05-29 10:58:09 +0000 |
| commit | e1f45b23b333b2783fe97398bbedf4095ef2d5d0 (patch) | |
| tree | 0c065cce1984fb083b873b20be75cd1ec22a9703 /lib/libcrypt | |
| parent | b05e79d7cc24c54068106dd21e360eb5b95e03fc (diff) | |
Avoid null SEGV if libargon passed string with too few $
Seen on netbsd-9 built xscreensaver running on a current system.
Whatever triggered this should also be fixed, but in the meantime
we can improve the behaviour from "Segmentation Fault"
Diffstat (limited to 'lib/libcrypt')
| -rw-r--r-- | lib/libcrypt/crypt-argon2.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libcrypt/crypt-argon2.c b/lib/libcrypt/crypt-argon2.c index 31b0fdaf97b..c2a7b70f74f 100644 --- a/lib/libcrypt/crypt-argon2.c +++ b/lib/libcrypt/crypt-argon2.c @@ -335,13 +335,17 @@ decode_option(argon2_context *ctx, argon2_type *atype, const char *option) } a = strsep(&inp, "$"); + if (a == null) { + free(in); + return -1; + } sl = ctx->saltlen; if (from_base64(ctx->salt, &sl, a) == NULL) { - free(in); + free(in); return -1; - } + } ctx->saltlen = sl; |
