diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-06-21 20:02:01 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-06-21 20:02:01 -0700 |
commit | 6811f77cdd926b6eb42b3dfacae6946667314426 (patch) | |
tree | 784f0a6cefbb7f8e5cd6995e7b046a7ad22acccd | |
parent | 152eeb45d64db1398145ef7a935a132707b75e43 (diff) | |
download | subsurface-6811f77cdd926b6eb42b3dfacae6946667314426.tar.gz |
Fix incorrect buffer length calculation
Oops, this is bad as it will lead to a certain buffer overrun.
The other change is more cosmetic - nested open comment '/*'.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | git-access.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/git-access.c b/git-access.c index e5029f62a..062152b0a 100644 --- a/git-access.c +++ b/git-access.c @@ -215,7 +215,7 @@ static int check_remote_status(git_repository *repo, git_remote *origin, const c if (git_branch_upstream(&remote_ref, local_ref)) { /* so there is no upstream branch for our branch; that's a problem. - /* let's push our branch */ + * let's push our branch */ git_strarray refspec; git_reference_list(&refspec, repo); #if USE_LIBGIT23_API @@ -374,7 +374,7 @@ static git_repository *create_local_repo(const char *localdir, const char *remot error = git_clone(&cloned_repo, remote, localdir, &opts); if (error) { char *msg = giterr_last()->message; - int len = sizeof("Reference 'refs/remotes/origin/' not found" + strlen(branch)); + int len = sizeof("Reference 'refs/remotes/origin/' not found") + strlen(branch); char *pattern = malloc(len); snprintf(pattern, len, "Reference 'refs/remotes/origin/%s' not found", branch); if (strstr(remote, prefs.cloud_git_url) && strstr(msg, pattern)) { |