projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use stack-allocated strings for temporary filenames.
[tinc]
/
src
/
conf.c
diff --git
a/src/conf.c
b/src/conf.c
index
997a05e
..
2e13e45
100644
(file)
--- a/
src/conf.c
+++ b/
src/conf.c
@@
-487,6
+487,7
@@
FILE *ask_and_open(const char *filename, const char *what) {
FILE *r;
char *directory;
char line[PATH_MAX];
FILE *r;
char *directory;
char line[PATH_MAX];
+ char abspath[PATH_MAX];
const char *fn;
/* Check stdin and stdout */
const char *fn;
/* Check stdin and stdout */
@@
-520,12
+521,10
@@
FILE *ask_and_open(const char *filename, const char *what) {
if(fn[0] != '/') {
#endif
/* The directory is a relative path or a filename. */
if(fn[0] != '/') {
#endif
/* The directory is a relative path or a filename. */
- char *p;
-
directory = get_current_dir_name();
directory = get_current_dir_name();
-
xasprintf(&p
, "%s/%s", directory, fn);
+
snprintf(abspath, sizeof abspath
, "%s/%s", directory, fn);
free(directory);
free(directory);
- fn =
p
;
+ fn =
abspath
;
}
umask(0077); /* Disallow everything for group and other */
}
umask(0077); /* Disallow everything for group and other */