]> git.ipfire.org Git - thirdparty/git.git/blobdiff - setup.c
setup.c: do not feed NULL to "%.*s" even with precision 0
[thirdparty/git.git] / setup.c
diff --git a/setup.c b/setup.c
index 2b64cbbbfac60ac2db169ea19c03c891f0333864..577fc6323131fc0de9480b6bb2757366595f810b 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -99,7 +99,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)) {