summaryrefslogtreecommitdiff
path: root/sysdep/unix/main.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-03-19 13:00:00 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2012-03-19 13:00:00 +0100
commitdf27911880bffb88c1eae90e36c755a3ed3d77ad (patch)
treea1443a50756e8b32fa79c9271a500f73360774bb /sysdep/unix/main.c
parentaf582c4811175d9a27ed5d08a4f6d5eaa69ecec7 (diff)
Fixes problem with dirname().
Thanks Henrique de Moraes Holschuh for the original patch.
Diffstat (limited to 'sysdep/unix/main.c')
-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;
}