summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 108bebe)
raw | patch | inline | side by side (parent: 108bebe)
author | Alex Riesen <raa.lkml@gmail.com> | |
Sun, 26 Oct 2008 22:07:24 +0000 (23:07 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 27 Oct 2008 05:10:28 +0000 (22:10 -0700) |
Otherwise the function sometimes fail to resolve obviously correct
refnames, because the string data pointed to by "str" argument were
reused.
The change in dwim_log does not fix anything, just optimizes away
strcpy code as the path can be created directly in the available
buffer.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refnames, because the string data pointed to by "str" argument were
reused.
The change in dwim_log does not fix anything, just optimizes away
strcpy code as the path can be created directly in the available
buffer.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_name.c | patch | blob | history |
diff --git a/sha1_name.c b/sha1_name.c
index 4fb77f8863ec075de38b84171d3ef039a00cee4c..75a5a7e96f292bed344a7609fca2f3a45ba4314e 100644 (file)
--- a/sha1_name.c
+++ b/sha1_name.c
*ref = NULL;
for (p = ref_rev_parse_rules; *p; p++) {
+ char fullref[PATH_MAX];
unsigned char sha1_from_ref[20];
unsigned char *this_result;
this_result = refs_found ? sha1_from_ref : sha1;
- r = resolve_ref(mkpath(*p, len, str), this_result, 1, NULL);
+ mksnpath(fullref, sizeof(fullref), *p, len, str);
+ r = resolve_ref(fullref, this_result, 1, NULL);
if (r) {
if (!refs_found++)
*ref = xstrdup(r);
char path[PATH_MAX];
const char *ref, *it;
- strcpy(path, mkpath(*p, len, str));
+ mksnpath(path, sizeof(path), *p, len, str);
ref = resolve_ref(path, hash, 1, NULL);
if (!ref)
continue;