Skip to content

Commit

Permalink
git-config-set: Properly terminate strings with '\0'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Nov 21, 2005
1 parent e814bc4 commit 3dd94e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions config-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] == '!') {
Expand Down
1 change: 1 addition & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3dd94e3

Please sign in to comment.