[PATCH 08/15] tgtadm: zero out buffer used for requests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Arne Redlich <arne.redlich@xxxxxxxxxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux