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@
-/* $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 <kristaps@bsd.lv>
*
}
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))) {