From eaa0c9aa08350ce8a1343aed4c0a87c1cc329b0e Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Thu, 21 Jan 2016 20:10:13 +0000 Subject: [PATCH] Fix truncated fgetc return value in main(espeak-ng.c). [Coverity] --- src/espeak-ng.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/espeak-ng.c b/src/espeak-ng.c index 7d7c81c6..83695f02 100644 --- a/src/espeak-ng.c +++ b/src/espeak-ng.c @@ -672,8 +672,10 @@ int main(int argc, char **argv) } else { // bulk input on stdin ix = 0; - while (!feof(stdin)) { - p_text[ix++] = fgetc(stdin); + while (true) { + if ((c = fgetc(stdin)) == EOF) + break; + p_text[ix++] = (char)c; if (ix >= (max-1)) { max += 1000; char *new_text = (char *)realloc(p_text, max);