diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-17 14:44:05 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-10-17 14:44:05 +0000 |
commit | 5356c27eb2103ee03fcd036afb21a63e063842ba (patch) | |
tree | 5ebc5248625cafc4edc7a0d6075316be94ba70a3 /src/libs6rc | |
parent | 29f0382d7532eca906774d6b614a0e0a0a18447d (diff) | |
download | s6-rc-5356c27eb2103ee03fcd036afb21a63e063842ba.tar.xz |
Limit prefix size to NAME_MAX
Diffstat (limited to 'src/libs6rc')
-rw-r--r-- | src/libs6rc/s6rc_livedir_prefixsize.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libs6rc/s6rc_livedir_prefixsize.c b/src/libs6rc/s6rc_livedir_prefixsize.c index daa8481..38d060a 100644 --- a/src/libs6rc/s6rc_livedir_prefixsize.c +++ b/src/libs6rc/s6rc_livedir_prefixsize.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <limits.h> #include <string.h> #include <sys/stat.h> #include <errno.h> @@ -19,6 +20,7 @@ int s6rc_livedir_prefixsize (char const *live, size_t *n) return 1 ; } if (!S_ISREG(st.st_mode)) return (errno = EINVAL, 0) ; + if (st.st_size > NAME_MAX) return (errno = ENAMETOOLONG, 0) ; *n = st.st_size ; return 1 ; } |