The prefix_filename function returns a pointer to a static buffer which may be overwritten by subsequent calls. Since we are going to keep the result around for a while, let's be sure to duplicate it for safety. I don't think this can be triggered as a bug in the current code, but it's a good idea to be defensive, as any resulting bug would be quite subtle. Signed-off-by: Jeff King <peff@xxxxxxxx> --- I was tempted to simply use OPT_FILENAME to get the argument to "-f", which would handle the prefixing for us. However, we can also get the value from $GIT_CONFIG. That value doesn't actually run through this code currently, but I think it should (and I fix this in patch 6). builtin/config.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/builtin/config.c b/builtin/config.c index 09bf778..5a43a3c 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -391,9 +391,10 @@ int cmd_config(int argc, const char **argv, const char *prefix) config_exclusive_filename = git_pathdup("config"); else if (given_config_file) { if (!is_absolute_path(given_config_file) && prefix) - config_exclusive_filename = prefix_filename(prefix, - strlen(prefix), - given_config_file); + config_exclusive_filename = + xstrdup(prefix_filename(prefix, + strlen(prefix), + given_config_file)); else config_exclusive_filename = given_config_file; } -- 1.7.9.1.4.g8ffed -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html