diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2012-03-19 13:00:00 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2012-03-19 13:00:00 +0100 |
commit | df27911880bffb88c1eae90e36c755a3ed3d77ad (patch) | |
tree | a1443a50756e8b32fa79c9271a500f73360774bb /sysdep/unix | |
parent | af582c4811175d9a27ed5d08a4f6d5eaa69ecec7 (diff) |
Fixes problem with dirname().
Thanks Henrique de Moraes Holschuh for the original patch.
Diffstat (limited to 'sysdep/unix')
-rw-r--r-- | sysdep/unix/main.c | 5 |
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; } |