lnstools

Linux namespace tools
git clone https://ccx.te2000.cz/git/lnstools
Log | Files | Refs | README

commit c3838c58b485225753db7b0db5a0bc6eb9fdd9ce
parent a0935155f8491fc179f94e8b9e2f571f3dae8c6d
Author: Jan Pobrislo <ccx@te2000.cz>
Date:   Fri, 12 Dec 2025 02:01:08 +0000

Check for new_root lenght

Diffstat:
Msrc/lns-lockdown_main.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/lns-lockdown_main.c b/src/lns-lockdown_main.c @@ -78,6 +78,9 @@ void pivot_and_umount( strerr_dief1x(111, "realpath() returned invalid string"); } } + if(newroot_len == 0) { + strerr_dief1x(111, "got empty path?"); + } size_t mtp_count, mtp_n; size_t oldroot_len = strlen(put_old) - newroot_len; stralloc sa_env = STRALLOC_ZERO; @@ -279,11 +282,11 @@ int main (int argc, char const *const *argv) { } char *new_root = realpath(argv[0], NULL); if (new_root == NULL) { - strerr_diefu1sys(111, "to resolve first path"); + strerr_diefu1sys(111, "to resolve first path"); } char *put_old = realpath(argv[1], NULL); if (new_root == NULL) { - strerr_diefu1sys(111, "to resolve first path"); + strerr_diefu1sys(111, "to resolve first path"); } pivot_and_umount(new_root, put_old, &unex); free(new_root);