summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authoroki <oki@NetBSD.org>2002-03-24 05:55:49 +0000
committeroki <oki@NetBSD.org>2002-03-24 05:55:49 +0000
commitb10ef43c8ebd5ce99c047125bfe77458b998029f (patch)
treeb61c7acc7a9f63011624ffbe412d1186f2e9545b /sys/compat
parentb812152b3486a1c89ee0b46bee79f29b4ea786bf (diff)
Read /usr/libexec/ld.so.dll if failed to read
/emul/pecoff/usr/libexec/ld.so.dll. reported via IRC from kent, thanks.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/pecoff/pecoff_exec.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/compat/pecoff/pecoff_exec.c b/sys/compat/pecoff/pecoff_exec.c
index 7f6419fc577..bab3d9eb82b 100644
--- a/sys/compat/pecoff/pecoff_exec.c
+++ b/sys/compat/pecoff/pecoff_exec.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pecoff_exec.c,v 1.15 2002/03/18 07:11:06 oki Exp $ */
+/* $NetBSD: pecoff_exec.c,v 1.16 2002/03/24 05:55:49 oki Exp $ */
/*
* Copyright (c) 2000 Masaru OKI
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pecoff_exec.c,v 1.15 2002/03/18 07:11:06 oki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pecoff_exec.c,v 1.16 2002/03/24 05:55:49 oki Exp $");
/*#define DEBUG_PECOFF*/
@@ -203,8 +203,17 @@ pecoff_load_file(p, epp, path, vcset, entry, argp)
const char *bp;
if ((error = emul_find(p, NULL, epp->ep_esch->es_emul->e_path,
- path, &bp, 0)))
- return error;
+ path, &bp, 0))) {
+ char *ptr;
+ int len;
+
+ len = strlen(path) + 1;
+ if (len > MAXPATHLEN)
+ return error;
+ ptr = malloc(len, M_TEMP, M_WAITOK);
+ copystr(path, ptr, len, 0);
+ bp = ptr;
+ }
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, bp, p);
if ((error = namei(&nd)) != 0) {
free((void *)bp, M_TEMP);