From: Emil Engler Date: Thu, 1 Apr 2021 16:24:53 +0000 (+0200) Subject: libssh: get rid of PATH_MAX X-Git-Tag: curl-7_76_1~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1abc6624d8fb1bd2286feeb8b623dd4850fadbe;p=thirdparty%2Fcurl.git 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 --- 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; }