From: claudio Date: Tue, 28 Dec 2021 11:59:48 +0000 (+0000) Subject: In io_write_buf() adjust the calculation of the multiplex message size X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c91bd41216ce259530f7d5537bd4cbcc58894b62;p=openbsd In io_write_buf() adjust the calculation of the multiplex message size so that the loop works even for buffers bigger than 0xffffff. The code does not produce such big buffers but better make the code correct. Reported by Blago Dachev (blago (at) dachev (dot) com) OK benno@ --- diff --git a/usr.bin/rsync/io.c b/usr.bin/rsync/io.c index ea35bdb295f..87019a9567a 100644 --- a/usr.bin/rsync/io.c +++ b/usr.bin/rsync/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.20 2021/06/30 13:10:04 claudio Exp $ */ +/* $OpenBSD: io.c,v 1.21 2021/12/28 11:59:48 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -143,7 +143,7 @@ io_write_buf(struct sess *sess, int fd, const void *buf, size_t sz) } while (sz > 0) { - wsz = sz & 0xFFFFFF; + wsz = (sz < 0xFFFFFF) ? sz : 0xFFFFFF; tag = (7 << 24) + wsz; tagbuf = htole32(tag); if (!io_write_blocking(fd, &tagbuf, sizeof(tagbuf))) {