mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
kconfig: fix infinite loop when expanding a macro at the end of file
[ Upstream commitaf8bbce920
] A macro placed at the end of a file with no newline causes an infinite loop. [Test Kconfig] $(info,hello) \ No newline at end of file I realized that flex-provided input() returns 0 instead of EOF when it reaches the end of a file. Fixes:104daea149
("kconfig: reference environment variables directly and remove 'option env='") Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
36f99de1d7
commit
257b262937
1 changed files with 5 additions and 2 deletions
|
@ -302,8 +302,11 @@ static char *expand_token(const char *in, size_t n)
|
|||
new_string();
|
||||
append_string(in, n);
|
||||
|
||||
/* get the whole line because we do not know the end of token. */
|
||||
while ((c = input()) != EOF) {
|
||||
/*
|
||||
* get the whole line because we do not know the end of token.
|
||||
* input() returns 0 (not EOF!) when it reachs the end of file.
|
||||
*/
|
||||
while ((c = input()) != 0) {
|
||||
if (c == '\n') {
|
||||
unput(c);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue