Module Name: src Committed By: christos Date: Tue Dec 24 14:47:04 UTC 2013
Modified Files: src/sys/kern: kern_exec.c Log Message: replace strcpy with copystr and remove useless strcpy (Maxime Villard) To generate a diff of this commit: cvs rdiff -u -r1.367 -r1.368 src/sys/kern/kern_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.367 src/sys/kern/kern_exec.c:1.368 --- src/sys/kern/kern_exec.c:1.367 Sat Nov 23 17:15:16 2013 +++ src/sys/kern/kern_exec.c Tue Dec 24 09:47:04 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.367 2013/11/23 22:15:16 christos Exp $ */ +/* $NetBSD: kern_exec.c,v 1.368 2013/12/24 14:47:04 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.367 2013/11/23 22:15:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.368 2013/12/24 14:47:04 christos Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -319,8 +319,9 @@ check_exec(struct lwp *l, struct exec_pa if ((error = namei(&nd)) != 0) return error; epp->ep_vp = vp = nd.ni_vp; - /* this cannot overflow as both are size PATH_MAX */ - strcpy(epp->ep_resolvedname, nd.ni_pnbuf); + /* normally this can't fail */ + if ((error = copystr(nd.ni_pnbuf, epp->ep_resolvedname, PATH_MAX, NULL))) + goto bad1; #ifdef DIAGNOSTIC /* paranoia (take this out once namei stuff stabilizes) */ @@ -640,11 +641,7 @@ execve_loadvm(struct lwp *l, const char goto clrflg; } data->ed_pathstring = pathbuf_stringcopy_get(data->ed_pathbuf); - data->ed_resolvedpathbuf = PNBUF_GET(); -#ifdef DIAGNOSTIC - strcpy(data->ed_resolvedpathbuf, "/wrong"); -#endif /* * initialize the fields of the exec package.