Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/miscfs/fdesc Pull up revisions 1.51-1.53:



details:   https://anonhg.NetBSD.org/src/rev/38544cbdc78c
branches:  netbsd-1-4
changeset: 469304:38544cbdc78c
user:      he <he%NetBSD.org@localhost>
date:      Sat Aug 28 23:22:21 1999 +0000

description:
Pull up revisions 1.51-1.53:
  Protect {fdesc,kernfs,procfs}_readdir against directory seeks
  with bogus offsets.  (sommerfeld)

diffstat:

 sys/miscfs/fdesc/fdesc_vnops.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 2c259174fb1d -r 38544cbdc78c sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c    Sat Aug 28 22:49:05 1999 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c    Sat Aug 28 23:22:21 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc_vnops.c,v 1.47 1998/08/13 10:06:32 kleink Exp $  */
+/*     $NetBSD: fdesc_vnops.c,v 1.47.6.1 1999/08/28 23:22:21 he Exp $  */
 
 /*
  * Copyright (c) 1992, 1993
@@ -656,7 +656,7 @@
        struct uio *uio = ap->a_uio;
        struct dirent d;
        struct filedesc *fdp;
-       int i;
+       off_t i;
        int error;
        off_t *cookies = NULL;
        int ncookies = 0;
@@ -689,6 +689,9 @@
        if (VTOFDESC(ap->a_vp)->fd_type == Froot) {
                struct fdesc_target *ft;
 
+               if (i >= nfdesc_targets)
+                       return 0;
+
                if (ap->a_ncookies) {
                        ncookies = min(ncookies, (nfdesc_targets - i));
                        MALLOC(cookies, off_t *, ncookies * sizeof(off_t),
@@ -748,7 +751,7 @@
                                if (fdp->fd_ofiles[i - 2] == NULL)
                                        continue;
                                d.d_fileno = i - 2 + FD_STDIN;
-                               d.d_namlen = sprintf(d.d_name, "%d", i - 2);
+                               d.d_namlen = sprintf(d.d_name, "%d", (int) i - 2);
                                d.d_type = DT_UNKNOWN;
                                break;
                        }



Home | Main Index | Thread Index | Old Index