Created attachment 3463 [details] proposed patch from Red Hat Bug Originally reported as Red Hat Bug with patch: https://bugzilla.redhat.com/show_bug.cgi?id=1909988 When sorting files based on the modification time from remote glob in the client SFTP, the return values from sglob_comp() is wrong (1 or 0 and 0 or -1 with -r flag) causing the files are incorrectly sorted inside of the qsort, which expects -1, 0 or 1. For more information, see the analysis in the above bug.
Created attachment 3464 [details] tweaked patch I think it also needs to handle the == case.
fix committed and will be in OpenSSH 8.5
(In reply to Damien Miller from comment #1) > Created attachment 3464 [details] > tweaked patch > > I think it also needs to handle the == case. Thank you. Indeed, the equal is a corner case but your patch looks fine.
closing resolved bugs as of 8.6p1 release