mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
152eeb45d6
commit
6811f77cdd
1 changed files with 2 additions and 2 deletions
|
@ -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)) {
|
if (git_branch_upstream(&remote_ref, local_ref)) {
|
||||||
/* so there is no upstream branch for our branch; that's a problem.
|
/* 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_strarray refspec;
|
||||||
git_reference_list(&refspec, repo);
|
git_reference_list(&refspec, repo);
|
||||||
#if USE_LIBGIT23_API
|
#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);
|
error = git_clone(&cloned_repo, remote, localdir, &opts);
|
||||||
if (error) {
|
if (error) {
|
||||||
char *msg = giterr_last()->message;
|
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);
|
char *pattern = malloc(len);
|
||||||
snprintf(pattern, len, "Reference 'refs/remotes/origin/%s' not found", branch);
|
snprintf(pattern, len, "Reference 'refs/remotes/origin/%s' not found", branch);
|
||||||
if (strstr(remote, prefs.cloud_git_url) && strstr(msg, pattern)) {
|
if (strstr(remote, prefs.cloud_git_url) && strstr(msg, pattern)) {
|
||||||
|
|
Loading…
Reference in a new issue