Fix for config file section parsing.

Currently, if the target key has a section that matches
the initial substring of another section we mistakenly
believe we've found the correct section.  To avoid this
problem, ensure that the section lengths are identical
before comparison.

Signed-off-by: Sean Estabrooks <seanlkml@sympatico.ca>
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
sean 2006-05-05 09:49:15 -04:00 коммит произвёл Junio C Hamano
Родитель 7abd7117ec
Коммит 93ddef3e2d
1 изменённых файлов: 3 добавлений и 2 удалений

Просмотреть файл

@ -335,8 +335,9 @@ static int store_aux(const char* key, const char* value)
store.offset[store.seen] = ftell(config_file);
store.state = KEY_SEEN;
store.seen++;
} else if(!strncmp(key, store.key, store.baselen))
store.state = SECTION_SEEN;
} else if (strrchr(key, '.') - key == store.baselen &&
!strncmp(key, store.key, store.baselen))
store.state = SECTION_SEEN;
}
return 0;
}