{"thread":{"id":"2074","subject":"Improve config file escape sanity checking","startedAt":"2005-10-11T19:13:57Z","lastAt":"2005-10-11T19:13:57Z","messageCount":1,"participants":["Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"9972","messageId":"Pine.LNX.4.64.0510111211080.14597@g5.osdl.org","threadId":"2074","inReplyTo":null,"subject":"Improve config file escape sanity checking","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-10-11T19:13:57Z","receivedAt":"2005-10-11T19:13:57Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nI had meant to disallow unknown escape characters in the config file \nparser, but instead an unknown escaped character would silently pass \nthrough as itself. That's correct for some cases (notably '\\' itself), but \nwasn't correct in general.\n\nThis fixes it, and makes the parser write a nice error message if the \nconfig file contains bogus escaped characters.\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\ndiff --git a/config.c b/config.c\nindex f3c4fa4..510456c 100644\n--- a/config.c\n+++ b/config.c\n@@ -64,7 +64,12 @@ static char *parse_value(void)\n \t\t\tcase 'n':\n \t\t\t\tc = '\\n';\n \t\t\t\tbreak;\n-\t\t\treturn NULL;\n+\t\t\t/* Some characters escape as themselves */\n+\t\t\tcase '\\\\': case '\"':\n+\t\t\t\tbreak;\n+\t\t\t/* Reject unknown escape sequences */\n+\t\t\tdefault:\n+\t\t\t\treturn NULL;\n \t\t\t}\n \t\t\tvalue[len++] = c;\n \t\t\tcontinue;\n"}]}