diff mbox series

[2/3] Fix coverity#292171

Message ID 20200420165756.13275-2-sbabic@denx.de
State Accepted
Headers show
Series [1/3] progress: drop nasty printf Trying to.. | expand

Commit Message

Stefano Babic April 20, 2020, 4:57 p.m. UTC
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 tools/swupdate-progress.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/tools/swupdate-progress.c b/tools/swupdate-progress.c
index 54e5125..723d7dc 100644
--- a/tools/swupdate-progress.c
+++ b/tools/swupdate-progress.c
@@ -265,6 +265,9 @@  int main(int argc, char **argv)
 
 		}
 
+		/*
+		 * Be sure that string in message are Null terminated
+		 */
 		if (msg.infolen > 0) {
 			if (msg.infolen >= sizeof(msg.info) - 1) {
 				msg.infolen = sizeof(msg.info) - 1;
@@ -272,6 +275,7 @@  int main(int argc, char **argv)
 			}
 			fprintf(stdout, "INFO : %s\n\n", msg.info);
 		}
+		msg.cur_image[sizeof(msg.cur_image) - 1] = '\0';
 
 		if (!psplash_ok && opt_p) {
 			psplash_ok = psplash_init(psplash_pipe_path);