Improve example REPL to exit if there is nothing on the stdin (#3193)

When reading from the stdin a '\n' character or an empty line/file
was expected to end the read. However, in case of an input which is not terminated
with a newline a buffer overflow will occur.

Test case:
```sh
$ echo -n "print('a')" | ./build/bin/jerry
```

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
This commit is contained in:
Péter Gál
2019-10-03 09:26:50 +02:00
committed by Robert Fancsik
parent 2096fba571
commit 5ed8647b9e
+1 -1
View File
@@ -861,7 +861,7 @@ main (int argc,
/* Read a line */
while (true)
{
if (fread (source_buffer_tail, 1, 1, stdin) != 1 && len == 0)
if (fread (source_buffer_tail, 1, 1, stdin) != 1)
{
is_done = true;
break;