summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Rees <rees@cvs.openbsd.org>2001-05-17 20:20:37 +0000
committerJim Rees <rees@cvs.openbsd.org>2001-05-17 20:20:37 +0000
commit0a5a60040cab536661fbaed9504b35d0f441a328 (patch)
tree9e9b53af6e81e8188eda66f27ffed201337822f0
parentbbb27ad79f17285e2a4140ef772ceb71d5ff72a2 (diff)
don't copy past end of record in readdir_r (ok by art)
-rw-r--r--lib/libc/gen/readdir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c
index 867f3e904f0..e4e77b2d573 100644
--- a/lib/libc/gen/readdir.c
+++ b/lib/libc/gen/readdir.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: readdir.c,v 1.4 1999/09/01 23:19:41 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: readdir.c,v 1.5 2001/05/17 20:20:36 rees Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -98,7 +98,7 @@ readdir_r(dirp, entry, result)
return errno;
}
if (dp != NULL)
- memcpy(entry, dp, sizeof *entry);
+ memcpy(entry, dp, sizeof (struct dirent) - MAXNAMLEN + dp->d_namlen);
_FD_UNLOCK(dirp->dd_fd, FD_READ);
if (dp != NULL)
*result = entry;