Segfault due to use of non-portable strerror_r
Issue 237 by natanael.c... on 2014-12-17 08:35:16:
<b>What steps will reproduce the problem?</b>
- build cryptsetup with musl libc
- run: cryptsetup -y -v luksFormat /path/to/tempfile
- on the question "Are you sure? (Type uppercase yes):" type anything but YES. Simply <enter> will trigger it.
<b>What is the expected output? What do you see instead?</b>
Expected: Command failed with code 22: Invalid argument
What happens: Segfault
<b>What version of the product are you using? On what operating system?</b>
cryptsetup-1.6.6 on Alpine Linux (which uses musl libc)
<b>Please provide any additional information below.</b>
reported here: http://bugs.alpinelinux.org/issues/3470
backtrace:
Core was generated by `cryptsetup -y -v luksFormat /home/ncopa/test/test.img'.
Program terminated with signal 11, Segmentation fault.
#0 0x00006c0f7f877c1b in __stpncpy (
d=d@entry=0x77da45f183b8 "Invalid argument", s=0x0, n=n@entry=256)
at src/string/stpncpy.c:18
18 src/string/stpncpy.c: No such file or directory.
(gdb) bt
#0 0x00006c0f7f877c1b in __stpncpy (
d=d@entry=0x77da45f183b8 "Invalid argument", s=0x0, n=n@entry=256)
at src/string/stpncpy.c:18
#1 0x00006c0f7f8781c1 in strncpy (
d=d@entry=0x77da45f183b8 "Invalid argument", s=<optimized out>,
n=n@entry=256) at src/string/strncpy.c:7
#2 0x000006ec125723be in show_status (errcode=-22) at utils_tools.c:184
#3 0x000006ec12570c48 in run_action (
action=0x6ec12779218 ) at cryptsetup.c:1425
#4 main (argc=5, argv=0x77da45f185e8) at cryptsetup.c:1698