[PATCH] lib: fwts_pipeio: fix incorrect size of command being passed

Colin King colin.king at canonical.com
Thu Apr 13 09:42:40 UTC 2017


From: Colin Ian King <colin.king at canonical.com>

Using sizeof(command) is clearly incorrect, we should be passing
the length of the command instead of the size of the pointer.

Detected with static analysis.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/lib/src/fwts_pipeio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/src/fwts_pipeio.c b/src/lib/src/fwts_pipeio.c
index a2c941f4..fd719640 100644
--- a/src/lib/src/fwts_pipeio.c
+++ b/src/lib/src/fwts_pipeio.c
@@ -342,7 +342,7 @@ int fwts_exec2(const char *command, char **output)
 	}
 
 	if (fwts_pipe_readwrite(in_fd,
-		command, sizeof(command),
+		command, strlen(command),
 		out_fd, output, &out_len)) {
 		return -1;
 	}
-- 
2.11.0




More information about the fwts-devel mailing list