1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-13 20:26:08 +02:00

Merge branch 'jc/xstrfmt-null-with-prec-0'

* jc/xstrfmt-null-with-prec-0:
  setup.c: do not feed NULL to "%.*s" even with precision 0
This commit is contained in:
Junio C Hamano 2016-04-22 15:45:07 -07:00
commit 3f80d16c1c

View File

@ -102,7 +102,7 @@ char *prefix_path_gently(const char *prefix, int len,
return NULL;
}
} else {
sanitized = xstrfmt("%.*s%s", len, prefix, path);
sanitized = xstrfmt("%.*s%s", len, len ? prefix : "", path);
if (remaining_prefix)
*remaining_prefix = len;
if (normalize_path_copy_len(sanitized, sanitized, remaining_prefix)) {