Thanks Mattias!Your patch has been submitted upstream, the PR [1] is now merged so I backported it as a debian patch [2]. I'll soon upload the new version if everything is fine.
/Nicolas [1] https://github.com/libssh2/libssh2/pull/1415[2] https://salsa.debian.org/debian/libssh2/-/blob/master/debian/patches/maxpathlen.patch?ref_type=heads