{"thread":{"id":"11996","subject":"[PATCH] commit.c: guard config parser from value=NULL","startedAt":"2008-02-09T20:16:10Z","lastAt":"2008-02-10T02:57:43Z","messageCount":2,"participants":["Govind Salinas","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"68116","messageId":"5d46db230802091216h40f88f06r20ebb84de6717af6@mail.gmail.com","threadId":"11996","inReplyTo":null,"subject":"[PATCH] commit.c: guard config parser from value=NULL","fromName":"Govind Salinas","fromEmail":"govind@sophiasuchtig.com","sentAt":"2008-02-09T20:16:10Z","receivedAt":"2008-02-09T20:16:10Z","isPatch":true,"sender":{"key":"govind@sophiasuchtig.com","avatar":null},"body":"Signed-off-by: Govind Salinas <blix@sophiasuchtig.com>\n---\n config.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex 498259e..8247e88 100644\n--- a/config.c\n+++ b/config.c\n@@ -407,12 +407,12 @@ int git_default_config(const char *var, const char *value)\n \t\treturn 0;\n \t}\n\n-\tif (!strcmp(var, \"user.name\")) {\n+\tif (value && !strcmp(var, \"user.name\")) {\n \t\tstrlcpy(git_default_name, value, sizeof(git_default_name));\n \t\treturn 0;\n \t}\n\n-\tif (!strcmp(var, \"user.email\")) {\n+\tif (value && !strcmp(var, \"user.email\")) {\n \t\tstrlcpy(git_default_email, value, sizeof(git_default_email));\n \t\treturn 0;\n \t}\n-- \n1.5.4.36.g9af61\n"},{"id":"68156","messageId":"7vir0x5xi0.fsf@gitster.siamese.dyndns.org","threadId":"11996","inReplyTo":"5d46db230802091216h40f88f06r20ebb84de6717af6@mail.gmail.com","subject":"Re: [PATCH] commit.c: guard config parser from value=NULL","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-10T02:57:43Z","receivedAt":"2008-02-10T02:57:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Govind Salinas\" <govind@sophiasuchtig.com> writes:\n\n> -\tif (!strcmp(var, \"user.name\")) {\n> +\tif (value && !strcmp(var, \"user.name\")) {\n>  \t\tstrlcpy(git_default_name, value, sizeof(git_default_name));\n>  \t\treturn 0;\n>  \t}\n\nThis is wrong, isn't it?  When somebody says\n\n\t[user]\n        \tname\n\nwe should not silently ignore it, but instead say \"user.name is\nnot a bool!\" and error out.\n\nThe same comment applies to all other\n\n\tif (value && !strcmp(var, \"<varname>\"))\n\nconversions.\n"}]}