[stgt] [PATCH 08/15] tgtadm: zero out buffer used for requests
Arne Redlich
arne.redlich at googlemail.com
Tue Jun 9 18:22:26 CEST 2009
Signed-off-by: Arne Redlich <arne.redlich at googlemail.com>
---
We should probably check if valloc actually returned a buffer?
usr/tgtadm.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
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
More information about the stgt
mailing list