summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4757745)
raw | patch | inline | side by side (parent: 4757745)
author | Miklos Vajna <vmiklos@frugalware.org> | |
Mon, 17 Nov 2008 20:48:35 +0000 (21:48 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 18 Nov 2008 23:40:02 +0000 (15:40 -0800) |
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>
to unallocated memory otherwise.
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-branch.c | patch | blob | history |
diff --git a/builtin-branch.c b/builtin-branch.c
index 2b3613fea2d7799b7d20e9e30da20527d811ed64..b9149b78f406e950295e1df31d686e1d74bfebd6 100644 (file)
--- a/builtin-branch.c
+++ b/builtin-branch.c
unsigned char sha1[20];
char *name = NULL;
const char *fmt, *remote;
- char section[PATH_MAX];
int i;
int ret = 0;
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);
}
}