Commit 83885891f583ab447f98f1c7a637f1f507e1be22

Justin Spahr-Summers 2012-11-04T22:01:24

Bail out if remote->url would be NULL This fixes a crash from attempting to invoke git__strdup() against NULL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/src/remote.c b/src/remote.c
index 47bcaf9..187e395 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -131,6 +131,11 @@ 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) {
+		error = -1;
+		goto cleanup;
+	}
 
 	remote->repo = repo;
 	remote->url = git__strdup(val);