diff options
author | delphij <delphij@FreeBSD.org> | 2009-05-29 05:51:19 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2009-05-29 05:51:19 +0000 |
commit | 88adf607eaaf6d2a6e84ae648dfa44a62069cfab (patch) | |
tree | 0797a5a19252c2fb2b5c378a0d773e921eb6ee45 /sys/compat/svr4 | |
parent | 2095d11d4e693197f9de001e1fc300afcd8229c3 (diff) | |
download | FreeBSD-src-88adf607eaaf6d2a6e84ae648dfa44a62069cfab.zip FreeBSD-src-88adf607eaaf6d2a6e84ae648dfa44a62069cfab.tar.gz |
svr4_sys_getdents64() should not assume that the cookie would exist
everywhere.
PR: kern/91293
Submitted by: "Pedro f. Giffuni" <giffunip asme org>
Obtained from: NetBSD
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r-- | sys/compat/svr4/svr4_misc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c index ac3dbaa..d352385 100644 --- a/sys/compat/svr4/svr4_misc.c +++ b/sys/compat/svr4/svr4_misc.c @@ -487,7 +487,10 @@ again: reclen = bdp->d_reclen; if (reclen & 3) panic("svr4_sys_getdents64: bad reclen"); - off = *cookie++; /* each entry points to the next */ + if (cookie) + off = *cookie++; /* each entry points to the next */ + else + off += reclen; if ((off >> 32) != 0) { uprintf("svr4_sys_getdents64: dir offset too large for emulated program"); error = EINVAL; |