Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/lib/libsa Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/0ce894e9591d
branches:  netbsd-6
changeset: 774356:0ce894e9591d
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Jul 25 15:29:02 2012 +0000

description:
Pull up following revision(s) (requested by mhitch in ticket #440):
        sys/lib/libsa/cd9660.c: revision 1.29
Fix cd9660_read() to not read past the end of the file.  This would result
in incorrect resid values, and causes the read of /boot.cfg to ignore the
file.  If the requested transfer extends past the end of the file, force
the internal buffer to be used, and when transferring data from the
internal buffer, limit the transfer to what's left in the file.  CDROM
boot will now process the /boot.cfg file.

diffstat:

 sys/lib/libsa/cd9660.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r 264baecbd062 -r 0ce894e9591d sys/lib/libsa/cd9660.c
--- a/sys/lib/libsa/cd9660.c    Wed Jul 25 15:12:37 2012 +0000
+++ b/sys/lib/libsa/cd9660.c    Wed Jul 25 15:29:02 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660.c,v 1.28 2011/12/25 06:09:08 tsutsui Exp $      */
+/*     $NetBSD: cd9660.c,v 1.28.2.1 2012/07/25 15:29:02 martin Exp $   */
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -318,6 +318,7 @@
                        break;
                bno = fp->off / ISO_DEFAULT_BLOCK_SIZE + fp->bno;
                if (fp->off & (ISO_DEFAULT_BLOCK_SIZE - 1)
+                   || (fp->off + ISO_DEFAULT_BLOCK_SIZE) > fp->size
                    || size < ISO_DEFAULT_BLOCK_SIZE)
                        dp = buf;
                else
@@ -336,6 +337,8 @@
                        if (nread > off + size)
                                nread = off + size;
                        nread -= off;
+                       if (nread > fp->size - fp->off)
+                               nread = fp->size - fp->off;
                        memcpy(start, buf + off, nread);
                        start = (char *)start + nread;
                        fp->off += nread;



Home | Main Index | Thread Index | Old Index