This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: fix buffer overrun in natFile.cc


Jeff Sturm wrote:

> On sparc-solaris, I find File.list() somtimes dumps core, for instance if
> libgcj is compiled with -O0.  In natFile.cc we have
>
>     struct dirent *d, d2;
>     while ((d = get_entry (dir, &d2)) != NULL)
>
> and
>
>   static struct dirent *
>   get_entry (DIR *dir, struct dirent *e)
>   {
>     struct dirent *r;
>     if (readdir_r (dir, e, &r) || r == NULL)
>
> but the info page for readdir_r says `e' must be at least (sizeof (struct
> dirent) + NAME_MAX + 1) bytes.  Oops.

Should we really be using these *_r functions anyway? In glibc I get the
impression that they are really only there for backwards compatibility, and I have
a feeling that they are generally less tested and more buggy than the normal ones.
Are there really any platforms out there that still don't have threadsafe
implementations of the "normal" IO routines?

regards

  [ bryce ]



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]