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) {
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to