From b63d2d683ddbbfc066fb4653b2e37e6c58875d6d Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sat, 22 Feb 2020 03:14:05 +0000 Subject: [PATCH] sh: fix read builtin on 32-bit systems Specifically, any system with a 32-bit size_t; -residue is calculated as a 32-bit *then* promoted to the 64-bit off_t and the result is ultimately wrong. This resulted in what would appear to be truncated output, as only the first line would be read. Correct it by just making residue an off_t to begin with, since this is what lseek will take anyways. Reported by: antoine, dim Triaged by: cem Tested by: kevans X-MFC-With: r358152 --- bin/sh/miscbltin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sh/miscbltin.c b/bin/sh/miscbltin.c index ad3d862fb6ef..a49dd05d109f 100644 --- a/bin/sh/miscbltin.c +++ b/bin/sh/miscbltin.c @@ -117,7 +117,7 @@ fdgetc(struct fdctx *fdc, char *c) static void fdctx_destroy(struct fdctx *fdc) { - size_t residue; + off_t residue; if (fdc->buflen > 1) { /*