summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-12 07:59:30 -0700
committerRussell Belfer <rb@github.com>2012-08-12 07:59:30 -0700
commita1ecddf01c5546b3f29cd546f4a469263cc6785e (patch)
tree256c14d824feba4e83a52cfdf2a5b1defe1c2b2b /src
parentc9d78bde943213f4c2594d1df175336573678b74 (diff)
downloadlibgit2-a1ecddf01c5546b3f29cd546f4a469263cc6785e.tar.gz
Fix config parser boundary logic
The config file parser was not working right if there was no whitespace between the value name and the equals sign. This fixes that.
Diffstat (limited to 'src')
-rw-r--r--src/config_file.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 80c63d2a3..433423582 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1343,10 +1343,9 @@ static int parse_variable(diskfile_backend *cfg, char **var_name, char **var_val
else
value_start = var_end + 1;
- if (git__isspace(var_end[-1])) {
- do var_end--;
- while (git__isspace(var_end[0]));
- }
+ var_end--;
+ while (git__isspace(*var_end))
+ var_end--;
*var_name = git__strndup(line, var_end - line + 1);
GITERR_CHECK_ALLOC(*var_name);