From aef952483b48edd612059c025f63d5b628df6f44 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Sat, 1 Mar 2025 21:46:15 +0800 Subject: HALF WORK: MAX_PATH --- modules/pam_namespace/pam_namespace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'modules/pam_namespace') diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c index ba7910f6..e224b218 100644 --- a/modules/pam_namespace/pam_namespace.c +++ b/modules/pam_namespace/pam_namespace.c @@ -1780,9 +1780,10 @@ cleanup: static int cwd_in(char *dir, struct instance_data *idata) { int retval = 0; - char cwd[PATH_MAX]; + char *cwd; - if (getcwd(cwd, PATH_MAX) == NULL) { + cwd = xgetcwd(); + if (cwd == NULL) { pam_syslog(idata->pamh, LOG_ERR, "Can't get current dir, %m"); return -1; } @@ -1796,6 +1797,7 @@ static int cwd_in(char *dir, struct instance_data *idata) pam_syslog(idata->pamh, LOG_DEBUG, "cwd is outside %s", dir); } + free(cwd); return retval; } -- cgit v1.2.3