From: Harsh Raj Singhania Date: Wed, 30 Sep 2026 18:57:56 +0000 (+0530) Subject: conf: reject absolute include paths containing /../ X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=f5377bbb572d88d9a59eee8ae26bff30d5a2ebb3;p=alsa-lib.git conf: reject absolute include paths containing /../ 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 Signed-off-by: Takashi Iwai --- diff --git a/src/conf.c b/src/conf.c index a27e6786..1469c7ed 100644 --- a/src/conf.c +++ b/src/conf.c @@ -643,8 +643,11 @@ static int input_stdio_open(snd_input_t **inputp, const char *file, 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.