s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit 1719a60278cf36558b568349c0c9f9b5eb91c999
parent fa7f29ff4b5aef142143e9c1d887d73788b703e4
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sat, 28 Aug 2021 23:56:14 +0000

 s6-svdir-(un)link fixes

Signed-off-by: Laurent Bercot <ska@appnovation.com>

Diffstat:
Msrc/libs6/s6_supervise_link_names.c | 2+-
Msrc/supervision/s6-svdir-link.c | 3++-
Msrc/supervision/s6-svdir-unlink.c | 2++
3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/libs6/s6_supervise_link_names.c b/src/libs6/s6_supervise_link_names.c @@ -54,7 +54,7 @@ int s6_supervise_link_names (char const *scdir, char const *const *servicedirs, int h ; char subdir[len + 5] ; if (nlen > maxnlen) maxnlen = nlen ; - if (len > maxlen) maxlen = nlen ; + if (len > maxlen) maxlen = len ; h = s6_svc_ok(servicedirs[i]) ; if (h < 0) return -1 ; if (h) bitarray_set(locked, i) ; diff --git a/src/supervision/s6-svdir-link.c b/src/supervision/s6-svdir-link.c @@ -91,7 +91,8 @@ int main (int argc, char const *const *argv) if (argc < 3) dieusage() ; if (!argv[0][0]) strerr_dief1x(100, "invalid scandir") ; - if (!argv[1][0]) strerr_dief1x(100, "invalid name") ; + if (!argv[1][0] || argv[1][0] == '.' || argv[1][0] == '/') + strerr_dief1x(100, "invalid name") ; if (!argv[2][0]) strerr_dief1x(100, "invalid servicedir") ; checkscandir(argv[0]) ; diff --git a/src/supervision/s6-svdir-unlink.c b/src/supervision/s6-svdir-unlink.c @@ -31,6 +31,8 @@ int main (int argc, char const *const *argv) } if (argc < 2) dieusage() ; + if (!argv[1][0] || argv[1][0] == '.' || argv[1][0] == '/') + strerr_dief1x(100, "invalid service name") ; s6_supervise_unlink(argv[0], argv[1], options) ; return 0 ; }