Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Apr 1995 06:52:28 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bugs@FreeBSD.org, craig@munich.gcomm.com
Subject:   Re: seekdir bug
Message-ID:  <199504122052.GAA25937@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>There is a bug when seeking through a directory.  telldir() seems to return
>a position in the directory that doesnt match the name of the file.  I've
>included a program that will exploit the bug.  I ran it as followed:

The man page says that "Values returned by telldir() are good only for
the lifetime of the DIR pointer, dirp, from which they are derived."
However, it also says that "It is safe to use a previous telldir() value
immediately after a call to opendir() and before any calls to
readdir()."  The second statement is now wrong because telldir() cookies
are reclaimed in closedir().  telldir() cookies are malloc()ed and (I
think) the memory for them used to be lost in closedir().

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504122052.GAA25937>