]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: If write() returned short, the subsequent write would restart github-selfhosted/master github/master
authordtucker@openbsd.org <dtucker@openbsd.org>
Fri, 3 Oct 2025 01:03:45 +0000 (01:03 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 6 Oct 2025 01:18:53 +0000 (12:18 +1100)
from the beginning of the buffer not the end of what was written.  Fix, since
we want modpipe to corrupt data for testing purposes deliberately not
accidentally.  ok djm@

OpenBSD-Regress-ID: 50ca74d287445c58944f070bb92dc13b1d054b43

regress/modpipe.c

index 5f4824b51d024df7d31da0f51fcf9799dee887e6..5ef2f12ed1f64a9cbec1525693de9bf22a313354 100644 (file)
@@ -14,7 +14,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $OpenBSD: modpipe.c,v 1.6 2013/11/21 03:16:47 djm Exp $ */
+/* $OpenBSD: modpipe.c,v 1.7 2025/10/03 01:03:45 dtucker Exp $ */
 
 #include "includes.h"
 
@@ -127,7 +127,7 @@ main(int argc, char **argv)
                        }
                }
                for (o = 0; o < s; o += r) {
-                       r = write(STDOUT_FILENO, buf, s - o);
+                       r = write(STDOUT_FILENO, buf + o, s - o);
                        if (r == 0)
                                break;
                        if (r < 0) {