From: sean Date: Fri, 5 May 2006 13:49:15 +0000 (-0400) Subject: Fix for config file section parsing. X-Git-Tag: v1.3.3~23 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=93ddef3e2dd5f7f3238fad9d52e974d03c7844f2;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/config.c b/config.c index 4e1f0c22..a3e14d76 100644 --- a/config.c +++ b/config.c @@ -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; }