Hello, I've forwarded the bug upstream [1] and they made a patch [2].
Can you test their patch on your package, to check if the problem is fixed on your CI?
Also, if this works, I suggest to apply their patch rather than yours to make the code more consistent with upstream, do you agree?
[1] https://github.com/libssh2/libssh2/issues/1240 [2] https://github.com/libssh2/libssh2/pull/1241