summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sysdep/unix/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c
index 49299411..a4e80154 100644
--- a/sysdep/unix/main.c
+++ b/sysdep/unix/main.c
@@ -170,7 +170,10 @@ cf_open(char *filename)
int ret;
if (*filename != '/') {
- snprintf(full_name, sizeof(full_name), "%s/%s", dirname(config_name), filename);
+ char dir[BIRD_FNAME_MAX];
+ strncpy(dir, config_name, sizeof(dir));
+ dir[sizeof(dir)-1] = 0;
+ snprintf(full_name, sizeof(full_name), "%s/%s", dirname(dir), filename);
full_name[sizeof(full_name)-1] = 0;
cur = full_name;
}