git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix "config_error_nonbool" used with value instead of key

From
Christian Couder <chriscool@tuxfamily.org>
Date
Jul 6, 2008, 04:10 UTC
Message-ID
<20080706061004.22f6c91c.chriscool@tuxfamily.org>

The function "config_error_nonbool", that is defined in "config.c", is used to report an error when a config key in the config file should have a corresponding value but it hasn't.

So the parameter to this function should be the key and not the value, because the value is undefined. And it could crash if the value is used.

This patches fixes two occurences where the value was passed instead of the key.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 builtin-tag.c |    2 +-
 wt-status.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin-tag.c b/builtin-tag.c
index e675206..3c97c69 100644
--- a/builtin-tag.c
+++ b/builtin-tag.c
@@ -260,7 +260,7 @@ static int git_tag_config(const char *var, const char *value, void *cb)
 {
 	if (!strcmp(var, "user.signingkey")) {
 		if (!value)
-			return config_error_nonbool(value);
+			return config_error_nonbool(var);
 		set_signingkey(value);
 		return 0;
 	}
diff --git a/wt-status.c b/wt-status.c
index 28c9e63..e7d42d0 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -399,7 +399,7 @@ int git_status_config(const char *k, const char *v, void *cb)
 	}
 	if (!strcmp(k, "status.showuntrackedfiles")) {
 		if (!v)
-			return config_error_nonbool(v);
+			return config_error_nonbool(k);
 		else if (!strcmp(v, "no"))
 			show_untracked_files = SHOW_NO_UNTRACKED_FILES;
 		else if (!strcmp(v, "normal"))
-- 
1.5.6.1.205.gc094f
Message 1 of 1 in “Fix "config_error_nonbool" used with value instead of key”
  1. Fix "config_error_nonbool" used with value instead of keyChristian Couder, Jul 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.