From c1abc6624d8fb1bd2286feeb8b623dd4850fadbe Mon Sep 17 00:00:00 2001 From: Emil Engler Date: Thu, 1 Apr 2021 18:24:53 +0200 Subject: [PATCH] libssh: get rid of PATH_MAX This removes the last occurrence of PATH_MAX inside our libssh implementation by calculating the path length from the string length of the two components. Closes #6829 --- lib/vssh/libssh.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 1bb644eedd..4644f4cb96 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -1453,16 +1453,15 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block) if((sshc->readdir_attrs->flags & SSH_FILEXFER_ATTR_PERMISSIONS) && ((sshc->readdir_attrs->permissions & S_IFMT) == S_IFLNK)) { - sshc->readdir_linkPath = malloc(PATH_MAX + 1); + sshc->readdir_linkPath = aprintf("%s%s", protop->path, + sshc->readdir_filename); + if(sshc->readdir_linkPath == NULL) { state(data, SSH_SFTP_CLOSE); sshc->actualcode = CURLE_OUT_OF_MEMORY; break; } - msnprintf(sshc->readdir_linkPath, PATH_MAX, "%s%s", protop->path, - sshc->readdir_filename); - state(data, SSH_SFTP_READDIR_LINK); break; } -- 2.47.3