Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-11-17 23:48:35 +0300
committerJunio C Hamano <gitster@pobox.com>2008-11-19 02:40:02 +0300
commit3c59c50d76cd479caf14cab73fdb09b68597d5e5 (patch)
tree79749fcfafcf3a65d13e7a79fb314069436fb8e9 /builtin-branch.c
parent47577456bfe61c32df73a7cf4a388f007af3b18f (diff)
builtin-branch: use strbuf in delete_branches()
In case the length of branch name is greather then PATH_MAX-7, we write to unallocated memory otherwise. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-branch.c')
-rw-r--r--builtin-branch.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin-branch.c b/builtin-branch.c
index 2b3613fea2..b9149b78f4 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -97,7 +97,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
unsigned char sha1[20];
char *name = NULL;
const char *fmt, *remote;
- char section[PATH_MAX];
int i;
int ret = 0;
@@ -165,11 +164,12 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
argv[i]);
ret = 1;
} else {
+ struct strbuf buf = STRBUF_INIT;
printf("Deleted %sbranch %s.\n", remote, argv[i]);
- snprintf(section, sizeof(section), "branch.%s",
- argv[i]);
- if (git_config_rename_section(section, NULL) < 0)
+ strbuf_addf(&buf, "branch.%s", argv[i]);
+ if (git_config_rename_section(buf.buf, NULL) < 0)
warning("Update of config-file failed");
+ strbuf_release(&buf);
}
}