diff mbox series

Fix coverity #292181

Message ID 20200419193104.22351-7-sbabic@denx.de
State Accepted
Headers show
Series Fix coverity #292181 | expand

Commit Message

Stefano Babic April 19, 2020, 7:31 p.m. UTC
Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 tools/swupdate-sysrestart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/swupdate-sysrestart.c b/tools/swupdate-sysrestart.c
index d711d2d..2435457 100644
--- a/tools/swupdate-sysrestart.c
+++ b/tools/swupdate-sysrestart.c
@@ -216,8 +216,8 @@  int main(int argc, char **argv)
 			 */
 			if (msg.infolen > sizeof(msg.info) - 1) {
 				msg.infolen = sizeof(msg.info) - 1;
-				msg.info[sizeof(msg.info) - 1] = '\0';
 			}
+			msg.info[msg.infolen] = '\0';
 			char *ipaddr = strstr(msg.info, PATTERN);
 			char *end;
 			if (ipaddr && (strlen(ipaddr) > strlen(PATTERN))) {