summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorrees <rees@openbsd.org>2001-05-17 20:20:36 +0000
committerrees <rees@openbsd.org>2001-05-17 20:20:36 +0000
commite476e33845e528c1fb0a121f89e6a1d1231ecc84 (patch)
tree188ef97843a70380e2d530b9e0da8b9bcb284d07 /lib/libc
parentInsert comma missing from r1.11 commit; found by beck@. (diff)
downloadwireguard-openbsd-e476e33845e528c1fb0a121f89e6a1d1231ecc84.tar.xz
wireguard-openbsd-e476e33845e528c1fb0a121f89e6a1d1231ecc84.zip
don't copy past end of record in readdir_r (ok by art)
Diffstat (limited to 'lib/libc')
-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;