diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | servconf.c | 7 |
2 files changed, 8 insertions, 4 deletions
@@ -3,6 +3,11 @@ | |||
3 | for arc4random_buf() and arc4random_uniform(); from Josh Gilkerson | 3 | for arc4random_buf() and arc4random_uniform(); from Josh Gilkerson |
4 | - (dtucker) [configure.ac] Bug #1741: Add section for Haiku, patch originally | 4 | - (dtucker) [configure.ac] Bug #1741: Add section for Haiku, patch originally |
5 | by Ingo Weinhold via Scott McCreary, ok djm@ | 5 | by Ingo Weinhold via Scott McCreary, ok djm@ |
6 | - (djm) OpenBSD CVS Sync | ||
7 | - djm@cvs.openbsd.org 2010/03/25 23:38:28 | ||
8 | [servconf.c] | ||
9 | from portable: getcwd(NULL, 0) doesn't work on all platforms, so | ||
10 | use a stack buffer; ok dtucker@ | ||
6 | 11 | ||
7 | 20100324 | 12 | 20100324 |
8 | - (dtucker) [contrib/cygwin/ssh-host-config] Mount the Windows directory | 13 | - (dtucker) [contrib/cygwin/ssh-host-config] Mount the Windows directory |
diff --git a/servconf.c b/servconf.c index fa442bcea..7d027ddb9 100644 --- a/servconf.c +++ b/servconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: servconf.c,v 1.206 2010/03/12 11:37:40 markus Exp $ */ | 1 | /* $OpenBSD: servconf.c,v 1.207 2010/03/25 23:38:28 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -470,15 +470,14 @@ parse_token(const char *cp, const char *filename, | |||
470 | char * | 470 | char * |
471 | derelativise_path(const char *path) | 471 | derelativise_path(const char *path) |
472 | { | 472 | { |
473 | char *expanded, *ret, *cwd; | 473 | char *expanded, *ret, cwd[MAXPATHLEN]; |
474 | 474 | ||
475 | expanded = tilde_expand_filename(path, getuid()); | 475 | expanded = tilde_expand_filename(path, getuid()); |
476 | if (*expanded == '/') | 476 | if (*expanded == '/') |
477 | return expanded; | 477 | return expanded; |
478 | if ((cwd = getcwd(NULL, 0)) == NULL) | 478 | if (getcwd(cwd, sizeof(cwd)) == NULL) |
479 | fatal("%s: getcwd: %s", __func__, strerror(errno)); | 479 | fatal("%s: getcwd: %s", __func__, strerror(errno)); |
480 | xasprintf(&ret, "%s/%s", cwd, expanded); | 480 | xasprintf(&ret, "%s/%s", cwd, expanded); |
481 | free(cwd); | ||
482 | xfree(expanded); | 481 | xfree(expanded); |
483 | return ret; | 482 | return ret; |
484 | } | 483 | } |