1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 16:45:06 -05:00

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
This commit is contained in:
Emil Engler 2021-04-01 18:24:53 +02:00 committed by Jay Satiro
parent 605aa03ac1
commit c1abc6624d

View File

@ -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;
}