X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=sha1_name.c;h=159c2ab84fa2cdde0e540024a1ca22e0bbb43af8;hb=4dd47c3b867f51211d0dc4474dab0fee5ca614da;hp=41b680915d7348bf622397da8b1465d3769a361a;hpb=f6576f4c0c6fa3b2d979faf28936c09480dedaab;p=git.git diff --git a/sha1_name.c b/sha1_name.c index 41b680915..159c2ab84 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -245,11 +245,13 @@ int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref) *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); @@ -272,7 +274,7 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log) 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;