[PATCH] git-config-set: Properly terminate strings with '\0'
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 21, 2005, 10:18 UTC
- Message-ID
- <Pine.LNX.4.63.0511211117530.13161@wbgn013.biozentrum.uni-wuerzburg.de>
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 <Johannes.Schindelin@gmx.de>
---
config-set.c | 1 + config.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
applies-to: f7083280a1a5b84bbf5c6e74177e21807d5ee56b 6da767ad3f7ca0c1e86e7ec42765fcb01417d695
diff --git a/config-set.c b/config-set.c index 5f654f7..d938f96 100644 --- a/config-set.c +++ b/config-set.c @@ -38,6 +38,7 @@ static int get_value(const char* key_, c 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 38c0edd..357c1ca 100644 --- a/config.c +++ b/config.c @@ -433,6 +433,7 @@ int git_config_set_multivar(const char* 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 --- 0.99.9.GIT