From: Mingli Yu
use malloc and strncpy altogether to replace
strdup for salt initialization to fix below
Segmentation fault:
# echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
[65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 7f3332256998 sp
7fff60d44410 error 4 in libnettle.so.6
On Fri, Apr 12, 2019 at 6:04 AM wrote:
>
> From: Mingli Yu
>
> use malloc and strncpy altogether to replace
> strdup for salt initialization to fix below
> Segmentation fault:
> # echo -n passwd| nettle-pbkdf2 -i 1 -l 16 salt
> [65534.886509] nettle-pbkdf2[708]: segfault at 1f594260 ip 7f33
Alon Bar-Lev writes:
> Isn't this a bug in libc/strdup and not in nettle? This implementation
> is the same as what expected from strdup.
I agree. Please file a bug report for the C library you're using. strdup
is a standard posix function (if not part of the C language standard),
and widely use
On Fri, Apr 12, 2019 at 10:07 AM Niels Möller wrote:
> > However, looking at the code, I believe the allocation of memory is
> > not required... it can be:
>
> The if (hex_salt) {...} block overwrites the salt storage, for in-place
> hex decoding. I don't quite like overwriting the strings passed
Thanks very much for Niels and Alon's information!
After double check, I found the strdup triggers Segmentation fault when
-std=c99 included in compiler flags while compile nettle.
On 2019年04月12日 15:10, Alon Bar-Lev wrote:
On Fri, Apr 12, 2019 at 10:07 AM Niels Möller wrote:
However, lookin