From: Johannes Schindelin Date: Mon, 21 Nov 2005 10:18:20 +0000 (+0100) Subject: git-config-set: Properly terminate strings with '\0' X-Git-Tag: v0.99.9k^2~32 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3dd94e3b2e2f5b00512273f96ab5628c742c112c;p=git.git git-config-set: Properly terminate strings with '\0' When a lowercase version of the key was generated, it was not terminated. Strangely enough, it worked on Linux and macosx anyway. Just cygwin barfed. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- diff --git a/config-set.c b/config-set.c index 5f654f7af..d938f9676 100644 --- a/config-set.c +++ b/config-set.c @@ -38,6 +38,7 @@ static int get_value(const char* key_, const char* regex_) key = malloc(strlen(key_)+1); for (i = 0; key_[i]; i++) key[i] = tolower(key_[i]); + key[i] = 0; if (regex_) { if (regex_[0] == '!') { diff --git a/config.c b/config.c index 5d237c862..e78520ba0 100644 --- a/config.c +++ b/config.c @@ -432,6 +432,7 @@ int git_config_set_multivar(const char* key, const char* value, return 1; } else store.key[i] = tolower(key[i]); + store.key[i] = 0; /* * The lock_file serves a purpose in addition to locking: the new