From 5356c27eb2103ee03fcd036afb21a63e063842ba Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 17 Oct 2017 14:44:05 +0000 Subject: Limit prefix size to NAME_MAX --- src/libs6rc/s6rc_livedir_prefixsize.c | 2 ++ 1 file changed, 2 insertions(+) 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 #include #include #include @@ -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 ; } -- cgit v1.2.3