From 183aa4f8317f5a64f1bc931551a342e6a93ce1c3 Mon Sep 17 00:00:00 2001 From: Jacques Germishuys Date: Wed, 30 Apr 2014 17:46:53 +0200 Subject: [PATCH] Check for NULL before passing it to vsnprintf --- src/config.c | 4 ++-- src/remote.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index b3168f735..16854c0c8 100644 --- a/src/config.c +++ b/src/config.c @@ -1144,7 +1144,7 @@ int git_config_parse_int64(int64_t *out, const char *value) } fail_parse: - giterr_set(GITERR_CONFIG, "Failed to parse '%s' as an integer", value); + giterr_set(GITERR_CONFIG, "Failed to parse '%s' as an integer", value ? value : "(null)"); return -1; } @@ -1164,7 +1164,7 @@ int git_config_parse_int32(int32_t *out, const char *value) return 0; fail_parse: - giterr_set(GITERR_CONFIG, "Failed to parse '%s' as a 32-bit integer", value); + giterr_set(GITERR_CONFIG, "Failed to parse '%s' as a 32-bit integer", value ? value : "(null)"); return -1; } diff --git a/src/remote.c b/src/remote.c index ea638e373..be7198a98 100644 --- a/src/remote.c +++ b/src/remote.c @@ -73,7 +73,7 @@ static int ensure_remote_name_is_valid(const char *name) if (!git_remote_is_valid_name(name)) { giterr_set( GITERR_CONFIG, - "'%s' is not a valid remote name.", name); + "'%s' is not a valid remote name.", name ? name : "(null)"); error = GIT_EINVALIDSPEC; }