summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs6rc/s6rc_livedir_prefixsize.c2
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 ;
}