From 12dccf8463c7f35da77be4b3bcb1c20f19a2ef0a Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Sat, 9 Jan 2016 11:08:18 +0100 Subject: [PATCH] check that socket path is a directory --- sndiod/sndiod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sndiod/sndiod.c b/sndiod/sndiod.c index b8c78a0..ca55e32 100644 --- a/sndiod/sndiod.c +++ b/sndiod/sndiod.c @@ -273,6 +273,8 @@ getbasepath(char *base, size_t size) umask(omask); if (stat(base, &sb) < 0) err(1, "stat(\"%s\")", base); + if (!S_ISDIR(sb.st_mode)) + errx(1, "%s is not a directory", base); if (sb.st_uid != uid || (sb.st_mode & mask) != 0) errx(1, "%s has wrong permissions", base); }