From 88adf607eaaf6d2a6e84ae648dfa44a62069cfab Mon Sep 17 00:00:00 2001 From: delphij Date: Fri, 29 May 2009 05:51:19 +0000 Subject: svr4_sys_getdents64() should not assume that the cookie would exist everywhere. PR: kern/91293 Submitted by: "Pedro f. Giffuni" Obtained from: NetBSD --- sys/compat/svr4/svr4_misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/compat/svr4') 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; -- cgit v1.1