summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-03-08 02:11:34 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2013-03-09 15:45:18 +0100
commit48bde2f1b62d24f3982382d520bfac887537641d (patch)
treeda7dde9bafe3725298d7de04e6b52f351cc6c054 /src
parent92ebbe99c9b557aee3382f51ddf6dd6637ee2fe4 (diff)
downloadlibgit2-48bde2f1b62d24f3982382d520bfac887537641d.tar.gz
config: don't allow passing NULL as a value to set
Passing NULL is non-sensical. The error message leaves to be desired, though, as it leaks internal implementation details. Catch it at the `git_config_set_string` level and set an appropriate error message.
Diffstat (limited to 'src')
-rw-r--r--src/config.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index d6aa3078c..c7022891d 100644
--- a/src/config.c
+++ b/src/config.c
@@ -362,6 +362,11 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
git_config_backend *file;
file_internal *internal;
+ if (!value) {
+ giterr_set(GITERR_CONFIG, "The value to set cannot be NULL");
+ return -1;
+ }
+
internal = git_vector_get(&cfg->files, 0);
file = internal->file;