Module Name: src Committed By: christos Date: Sun Jan 17 14:46:07 UTC 2016
Modified Files: src/libexec/ftpd: cmds.c Log Message: PR/50665: David Binderman: move "dir" to the outer scope so it stays alive when the pointer is used later. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/libexec/ftpd/cmds.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/libexec/ftpd/cmds.c diff -u src/libexec/ftpd/cmds.c:1.34 src/libexec/ftpd/cmds.c:1.35 --- src/libexec/ftpd/cmds.c:1.34 Mon Aug 10 03:32:49 2015 +++ src/libexec/ftpd/cmds.c Sun Jan 17 09:46:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cmds.c,v 1.34 2015/08/10 07:32:49 shm Exp $ */ +/* $NetBSD: cmds.c,v 1.35 2016/01/17 14:46:07 christos Exp $ */ /* * Copyright (c) 1999-2009 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: cmds.c,v 1.34 2015/08/10 07:32:49 shm Exp $"); +__RCSID("$NetBSD: cmds.c,v 1.35 2016/01/17 14:46:07 christos Exp $"); #endif /* not lint */ #include <sys/param.h> @@ -600,7 +600,7 @@ static void fact_perm(const char *fact, FILE *fd, factelem *fe) { int rok, wok, xok, pdirwok; - struct stat *pdir; + struct stat *pdir, dir; if (fe->stat->st_uid == geteuid()) { rok = ((fe->stat->st_mode & S_IRUSR) != 0); @@ -627,7 +627,6 @@ fact_perm(const char *fact, FILE *fd, fa if (pdir == NULL && CURCLASS_FLAGS_ISSET(modify)) { size_t len; char realdir[MAXPATHLEN], *p; - struct stat dir; len = strlcpy(realdir, fe->path, sizeof(realdir)); if (len < sizeof(realdir) - 4) {