[stgt] [PATCH 08/15] tgtadm: zero out buffer used for requests
FUJITA Tomonori
fujita.tomonori at lab.ntt.co.jp
Fri Jun 12 04:35:50 CEST 2009
On Tue, 09 Jun 2009 18:22:26 +0200
Arne Redlich <arne.redlich at googlemail.com> wrote:
> Signed-off-by: Arne Redlich <arne.redlich at googlemail.com>
> ---
> We should probably check if valloc actually returned a buffer?
Yeah,
> usr/tgtadm.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
Applied, thanks.
>
> diff --git a/usr/tgtadm.c b/usr/tgtadm.c
> index 671af31..8d9f7e2 100644
> --- a/usr/tgtadm.c
> +++ b/usr/tgtadm.c
> @@ -426,6 +426,7 @@ int main(int argc, char **argv)
> char *bstype;
> char *user, *password;
> char *buf;
> + size_t bufsz = BUFSIZE + sizeof(struct tgtadm_req);
> struct tgtadm_req *req;
>
> op = tid = mode = -1;
> @@ -437,9 +438,8 @@ int main(int argc, char **argv)
> name = value = path = targetname = address = targetOps = bstype = NULL;
> user = password = NULL;
>
> - buf = valloc(BUFSIZE + sizeof(struct tgtadm_req));
> -
> - memset(buf, 0, sizeof(buf));
> + buf = valloc(bufsz);
> + memset(buf, 0, bufsz);
> req = (struct tgtadm_req *) buf;
>
> optind = 1;
> --
> 1.6.0.4
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe stgt" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list