config_set_multivar(): disallow newlines in keys

This will no longer work:

$ git repo-config 'key.with
newline' some-value

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2007-01-20 02:25:37 +01:00
committed by Junio C Hamano
parent d23842fd53
commit 6f71686e0b
2 changed files with 11 additions and 0 deletions

View File

@ -661,6 +661,11 @@ int git_config_set_multivar(const char* key, const char* value,
goto out_free;
}
c = tolower(c);
} else if (c == '\n') {
fprintf(stderr, "invalid key (newline): %s\n", key);
free(store.key);
ret = 1;
goto out_free;
}
store.key[i] = c;
}