- char *cur_statbuf = statbuf;
- char *cur_statbuf_tail = statbuf_tail;
-
- /* #### I don't think the code under `if' is necessary
- anymore. The crashes in this function were reported
- because MAXNAMLEN was used to remember the *whole*
- statbuf, instead of using MAXPATHLEN. This should be
- tested after 21.0 is released. */
-
- /* We normally use the buffer created by alloca.
- However, if the file name we get too big, we'll use a
- malloced buffer, and free it. It is undefined how
- stat() will react to this, but we avoid a buffer
- overrun. */
- if (len > MAXNAMLEN)
- {
- cur_statbuf = (char *)xmalloc (dirnamelen + len + 1);
- memcpy (cur_statbuf, statbuf, dirnamelen);
- cur_statbuf_tail = cur_statbuf + dirnamelen;
- }
- memcpy (cur_statbuf_tail, dp->d_name, len);
- cur_statbuf_tail[len] = 0;