Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 67beb60

Browse files
peffgitster
authored andcommitted
handle_path_include: don't look at NULL value
When we see config like: [include] path the expand_user_path helper notices that the config value is empty, but we then dereference NULL while printing the error message (glibc will helpfully print "(null)" for us here, but we cannot rely on that). $ git -c include.path rev-parse error: Could not expand include path '(null)' fatal: unable to parse command-line config Instead of tweaking our message, let's actually use config_error_nonbool to match other config variables that expect a value: $ git -c include.path rev-parse error: Missing value for 'include.path' fatal: unable to parse command-line config Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 53ec551 commit 67beb60

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ static int handle_path_include(const char *path, struct config_include_data *inc
3737
{
3838
int ret = 0;
3939
struct strbuf buf = STRBUF_INIT;
40-
char *expanded = expand_user_path(path);
40+
char *expanded;
4141

42+
if (!path)
43+
return config_error_nonbool("include.path");
44+
45+
expanded = expand_user_path(path);
4246
if (!expanded)
4347
return error("Could not expand include path '%s'", path);
4448
path = expanded;

0 commit comments

Comments
 (0)