Message ID | 20170413094240.27068-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
On 2017-04-13 02:42 AM, Colin King wrote: > From: Colin Ian King <colin.king@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@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; > } > Acked-by: Alex Hung <alex.hung@canonical.com>
On 04/13/2017 05:42 PM, Colin King wrote: > From: Colin Ian King <colin.king@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@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; > } > Acked-by: Ivan Hu <ivan.hu@canonical.com>
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; }