summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-03-26 10:40:04 +1100
committerDamien Miller <djm@mindrot.org>2010-03-26 10:40:04 +1100
commit44451d0af8ecbec2a17d47d75d3cca02d1239cf8 (patch)
treec488d1a5e8065ecaa3d31467e94fddc21b5a7d14
parenta83d90fbab8d8987d2086ce1fd5c5a05adb42c97 (diff)
- djm@cvs.openbsd.org 2010/03/25 23:38:28
[servconf.c] from portable: getcwd(NULL, 0) doesn't work on all platforms, so use a stack buffer; ok dtucker@
-rw-r--r--ChangeLog5
-rw-r--r--servconf.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 30a7ce26..cf3558c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,11 @@
for arc4random_buf() and arc4random_uniform(); from Josh Gilkerson
- (dtucker) [configure.ac] Bug #1741: Add section for Haiku, patch originally
by Ingo Weinhold via Scott McCreary, ok djm@
+ - (djm) OpenBSD CVS Sync
+ - djm@cvs.openbsd.org 2010/03/25 23:38:28
+ [servconf.c]
+ from portable: getcwd(NULL, 0) doesn't work on all platforms, so
+ use a stack buffer; ok dtucker@
20100324
- (dtucker) [contrib/cygwin/ssh-host-config] Mount the Windows directory
diff --git a/servconf.c b/servconf.c
index fa442bce..7d027ddb 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.c,v 1.206 2010/03/12 11:37:40 markus Exp $ */
+/* $OpenBSD: servconf.c,v 1.207 2010/03/25 23:38:28 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -470,15 +470,14 @@ parse_token(const char *cp, const char *filename,
char *
derelativise_path(const char *path)
{
- char *expanded, *ret, *cwd;
+ char *expanded, *ret, cwd[MAXPATHLEN];
expanded = tilde_expand_filename(path, getuid());
if (*expanded == '/')
return expanded;
- if ((cwd = getcwd(NULL, 0)) == NULL)
+ if (getcwd(cwd, sizeof(cwd)) == NULL)
fatal("%s: getcwd: %s", __func__, strerror(errno));
xasprintf(&ret, "%s/%s", cwd, expanded);
- free(cwd);
xfree(expanded);
return ret;
}