{"thread":{"id":"2626","subject":"[PATCH] git-config-set: Properly terminate strings with '\\0'","startedAt":"2005-11-21T10:18:20Z","lastAt":"2005-11-21T10:18:20Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"12426","messageId":"Pine.LNX.4.63.0511211117530.13161@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2626","inReplyTo":null,"subject":"[PATCH] git-config-set: Properly terminate strings with '\\0'","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-11-21T10:18:20Z","receivedAt":"2005-11-21T10:18:20Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWhen a lowercase version of the key was generated, it was not\nterminated. Strangely enough, it worked on Linux and macosx anyway.\nJust cygwin barfed.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n config-set.c |    1 +\n config.c     |    1 +\n 2 files changed, 2 insertions(+), 0 deletions(-)\n\napplies-to: f7083280a1a5b84bbf5c6e74177e21807d5ee56b\n6da767ad3f7ca0c1e86e7ec42765fcb01417d695\ndiff --git a/config-set.c b/config-set.c\nindex 5f654f7..d938f96 100644\n--- a/config-set.c\n+++ b/config-set.c\n@@ -38,6 +38,7 @@ static int get_value(const char* key_, c\n \tkey = malloc(strlen(key_)+1);\n \tfor (i = 0; key_[i]; i++)\n \t\tkey[i] = tolower(key_[i]);\n+\tkey[i] = 0;\n \n \tif (regex_) {\n \t\tif (regex_[0] == '!') {\ndiff --git a/config.c b/config.c\nindex 38c0edd..357c1ca 100644\n--- a/config.c\n+++ b/config.c\n@@ -433,6 +433,7 @@ int git_config_set_multivar(const char* \n \t\t\treturn 1;\n \t\t} else\n \t\t\tstore.key[i] = tolower(key[i]);\n+\tstore.key[i] = 0;\n \n \t/*\n \t * The lock_file serves a purpose in addition to locking: the new\n---\n0.99.9.GIT\n"}]}