Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Feb 2020 03:14:05 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358235 - head/bin/sh
Message-ID:  <202002220314.01M3E5xJ096135@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sat Feb 22 03:14:05 2020
New Revision: 358235
URL: https://svnweb.freebsd.org/changeset/base/358235

Log:
  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

Modified:
  head/bin/sh/miscbltin.c

Modified: head/bin/sh/miscbltin.c
==============================================================================
--- head/bin/sh/miscbltin.c	Sat Feb 22 01:31:06 2020	(r358234)
+++ head/bin/sh/miscbltin.c	Sat Feb 22 03:14:05 2020	(r358235)
@@ -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) {
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002220314.01M3E5xJ096135>