DORMANTno replies

[PATCH] git-config-set: Properly terminate strings with '\0'

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:42:13
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>

---

 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help