From 828bbdacac86123f72c518dddc9df8a66bd70580 Mon Sep 17 00:00:00 2001 From: manu Date: Wed, 21 Jul 2004 21:45:34 +0000 Subject: [PATCH] Don't assume ARG_MAX < MAXPATHLEN: someone might build with a modified constant --- sys/compat/darwin/darwin_exec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/compat/darwin/darwin_exec.c b/sys/compat/darwin/darwin_exec.c index 3d7fc212c562..8d82fdee5cd2 100644 --- a/sys/compat/darwin/darwin_exec.c +++ b/sys/compat/darwin/darwin_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: darwin_exec.c,v 1.36 2004/07/03 00:14:30 manu Exp $ */ +/* $NetBSD: darwin_exec.c,v 1.37 2004/07/21 21:45:34 manu Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include "opt_compat_darwin.h" /* For COMPAT_DARWIN in mach_port.h */ #include -__KERNEL_RCSID(0, "$NetBSD: darwin_exec.c,v 1.36 2004/07/03 00:14:30 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: darwin_exec.c,v 1.37 2004/07/21 21:45:34 manu Exp $"); #include "opt_syscall_debug.h" @@ -176,7 +176,8 @@ exec_darwin_copyargs(p, pack, arginfo, stackp, argp) dp = (char *) (cpp + argc + envc + 4); - if ((error = copyoutstr(emea->filename, dp, ARG_MAX, &len)) != 0) + if ((error = copyoutstr(emea->filename, dp, + (ARG_MAX < MAXPATHLEN) ? ARG_MAX : MAXPATHLEN, &len)) != 0) return error; progname = dp; dp += len;