summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config_file.c4
-rw-r--r--src/remote.c2
-rw-r--r--src/util.c11
3 files changed, 8 insertions, 9 deletions
diff --git a/src/config_file.c b/src/config_file.c
index 4ca842b89..4d9f99986 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -1432,8 +1432,10 @@ static int parse_variable(diskfile_backend *cfg, char **var_name, char **var_val
else if (value_start[0] != '\0') {
*var_value = fixup_line(value_start, 0);
GITERR_CHECK_ALLOC(*var_value);
+ } else { /* equals sign but missing rhs */
+ *var_value = git__strdup("");
+ GITERR_CHECK_ALLOC(*var_value);
}
-
}
git__free(line);
diff --git a/src/remote.c b/src/remote.c
index 8c46ca6a1..70a615246 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -136,7 +136,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
if ((error = git_config_get_string(&val, config, git_buf_cstr(&buf))) < 0)
goto cleanup;
- if (!val) {
+ if (!val || strlen(val) == 0) {
giterr_set(GITERR_INVALID, "Malformed remote '%s' - missing URL", name);
error = -1;
goto cleanup;
diff --git a/src/util.c b/src/util.c
index 0a82ccea6..7f5043817 100644
--- a/src/util.c
+++ b/src/util.c
@@ -432,12 +432,8 @@ int git__strcmp_cb(const void *a, const void *b)
int git__parse_bool(int *out, const char *value)
{
/* A missing value means true */
- if (value == NULL) {
- *out = 1;
- return 0;
- }
-
- if (!strcasecmp(value, "true") ||
+ if (value == NULL ||
+ !strcasecmp(value, "true") ||
!strcasecmp(value, "yes") ||
!strcasecmp(value, "on")) {
*out = 1;
@@ -445,7 +441,8 @@ int git__parse_bool(int *out, const char *value)
}
if (!strcasecmp(value, "false") ||
!strcasecmp(value, "no") ||
- !strcasecmp(value, "off")) {
+ !strcasecmp(value, "off") ||
+ value[0] == '\0') {
*out = 0;
return 0;
}