input_stdio_open() previously opened any absolute path without checking
for path traversal. Reject paths that contain "/../" so a planted config
cannot read arbitrary files.
Closes: https://github.com/alsa-project/alsa-lib/pull/527
Signed-off-by: Harsh Raj Singhania <raj.harshraut@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
char full_path[PATH_MAX];
int err;
- if (file[0] == '/')
+ if (file[0] == '/') {
+ if (strstr(file, "/../"))
+ return -ENOENT;
return snd_input_stdio_open(inputp, file, "r");
+ }
/* search file in user specified include paths. These directories
* are subdirectories of /usr/share/alsa.