Fixes problem with dirname().

Thanks Henrique de Moraes Holschuh for the original patch.
This commit is contained in:
Ondrej Zajicek 2012-03-19 13:00:00 +01:00
parent af582c4811
commit df27911880

View file

@ -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;
}