From: Dmitry V. Levin Date: Sat, 19 Apr 2008 23:49:58 +0000 (+0000) Subject: 2008-04-19 Dmitry V. Levin X-Git-Tag: v4.5.18~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=153fbd69d2a3d45033140ff55b6d31555eaec177;p=strace 2008-04-19 Dmitry V. Levin * file.c [_LFS64_LARGEFILE] (sys_getdents64): Do the same d_reclen check as in sys_getdents: warn if d_reclen is 0 rather than looping forever. [FREEBSD] (sys_getdirentries): Likewise. Signed-off-by: Mike Frysinger --- diff --git a/ChangeLog b/ChangeLog index e59b000f..7be5a949 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-04-19 Dmitry V. Levin + * file.c [_LFS64_LARGEFILE] (sys_getdents64): Do the same + d_reclen check as in sys_getdents: warn if d_reclen is 0 rather + than looping forever. + [FREEBSD] (sys_getdirentries): Likewise. + Signed-off-by: Mike Frysinger + * file.c [LINUXSPARC] (printstatsol): Fix sprinttime() invocation. The sprinttime() function takes a time_t argument, but timestruct_t argument was given. diff --git a/file.c b/file.c index 25fb5316..c038a555 100644 --- a/file.c +++ b/file.c @@ -2350,8 +2350,7 @@ static const struct xlat direnttypes[] = { #endif int -sys_getdents(tcp) -struct tcb *tcp; +sys_getdents(struct tcb *tcp) { int i, len, dents = 0; char *buf; @@ -2434,8 +2433,7 @@ struct tcb *tcp; #if _LFS64_LARGEFILE int -sys_getdents64(tcp) -struct tcb *tcp; +sys_getdents64(struct tcb *tcp) { int i, len, dents = 0; char *buf; @@ -2487,6 +2485,10 @@ struct tcb *tcp; d->d_namlen, d->d_namlen, d->d_name); } #endif /* SUNOS4 */ + if (!d->d_reclen) { + tprintf("/* d_reclen == 0, problem here */"); + break; + } i += d->d_reclen; dents++; } @@ -2502,8 +2504,7 @@ struct tcb *tcp; #ifdef FREEBSD int -sys_getdirentries(tcp) -struct tcb * tcp; +sys_getdirentries(struct tcb *tcp) { int i, len, dents = 0; long basep; @@ -2539,6 +2540,10 @@ struct tcb * tcp; tprintf(", d_namlen=%u, d_name=\"%.*s\"}", d->d_namlen, d->d_namlen, d->d_name); } + if (!d->d_reclen) { + tprintf("/* d_reclen == 0, problem here */"); + break; + } i += d->d_reclen; dents++; }