@matheusbsbs / matheus-bagliano / commits / 3dd94e3b2e
Fork 0

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 <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>

Johannes Schindelin committed Nov 21, 2005 at 11:18 UTC 3dd94e3b2e2f5b00512273f96ab5628c742c112c
2 files changed +2
config-set.c
+1
@@ -38,6 +38,7 @@ static int get_value(const char* key_, const char* regex_)
38 key = malloc(strlen(key_)+1);
39 for (i = 0; key_[i]; i++)
40 key[i] = tolower(key_[i]);
41 + key[i] = 0;
42
43 if (regex_) {
44 if (regex_[0] == '!') {
config.c
+1
@@ -432,6 +432,7 @@ int git_config_set_multivar(const char* key, const char* value,
432 return 1;
433 } else
434 store.key[i] = tolower(key[i]);
435 + store.key[i] = 0;
436
437 /*
438 * The lock_file serves a purpose in addition to locking: the new