From 6afc2263508313fc51a32c90e5fac707f2b5061d Mon Sep 17 00:00:00 2001 From: jihandong Date: Sat, 7 May 2022 16:06:39 +0800 Subject: [PATCH] nxlooper nxplayer nxrecorder: fix coverity bug readline might return EOF. Signed-off-by: jihandong --- system/nxlooper/nxlooper_main.c | 2 +- system/nxplayer/nxplayer_main.c | 2 +- system/nxrecorder/nxrecorder_main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/system/nxlooper/nxlooper_main.c b/system/nxlooper/nxlooper_main.c index 7650b94cf..ec4cd5601 100644 --- a/system/nxlooper/nxlooper_main.c +++ b/system/nxlooper/nxlooper_main.c @@ -528,9 +528,9 @@ int main(int argc, FAR char *argv[]) /* Read a line from the terminal */ len = readline(buffer, sizeof(buffer), stdin, stdout); - buffer[len] = '\0'; if (len > 0) { + buffer[len] = '\0'; if (strncmp(buffer, "!", 1) != 0) { /* nxlooper command */ diff --git a/system/nxplayer/nxplayer_main.c b/system/nxplayer/nxplayer_main.c index ef62d7f96..f7d9145f3 100644 --- a/system/nxplayer/nxplayer_main.c +++ b/system/nxplayer/nxplayer_main.c @@ -771,9 +771,9 @@ int main(int argc, FAR char *argv[]) /* Read a line from the terminal */ len = readline(buffer, sizeof(buffer), stdin, stdout); - buffer[len] = '\0'; if (len > 0) { + buffer[len] = '\0'; if (strncmp(buffer, "!", 1) != 0) { /* nxplayer command */ diff --git a/system/nxrecorder/nxrecorder_main.c b/system/nxrecorder/nxrecorder_main.c index 5e548cb12..b5eb5fd37 100644 --- a/system/nxrecorder/nxrecorder_main.c +++ b/system/nxrecorder/nxrecorder_main.c @@ -484,9 +484,9 @@ int main(int argc, FAR char *argv[]) /* Read a line from the terminal */ len = readline(buffer, sizeof(buffer), stdin, stdout); - buffer[len] = '\0'; if (len > 0) { + buffer[len] = '\0'; if (strncmp(buffer, "!", 1) != 0) { /* nxrecorder command */