OSDN Git Service

snd_user_file: avoid use wordexp
authorNatanael Copa <ncopa@alpinelinux.org>
Fri, 14 Jul 2017 16:47:05 +0000 (18:47 +0200)
committerTakashi Iwai <tiwai@suse.de>
Sat, 15 Jul 2017 07:57:46 +0000 (09:57 +0200)
commitcb34cee0d8da2fb131986d5782ddf5cec985c532
tree55d8cdd5a42ffd6d6b46782b2bc4f6d1080146e5
parentadab355f35c8fcb424b1336043634cf9a6856515
snd_user_file: avoid use wordexp

As suggested in POSIX[1], wordexp might execute the shell. If the libc
implementation does so, it will break the firefox sandbox which does
not allow exec. This happened on Alpine Linux with musl libc[2].

Since we cannot guarantee that the system wordexp implementation does
not execute shell, we cannot really use it, and need to implement the
~/ expansion ourselves.

We provide a configure option --with-wordexp for users that still may
need it, but we leave this off by default because wordexp is a large
attack vector and it is better to avoid it.

[1]: http://pubs.opengroup.org/onlinepubs/9699919799/functions/wordexp.html#tag_16_684_08
[2]: http://bugs.alpinelinux.org/issues/7454#note-2

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
configure.ac
src/userfile.c