From bbda499067067aefc8e642a2784d247ac0331eae Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 25 Dec 2004 17:43:16 +0000 Subject: Add memset() to different places to initialize the structures --- tools/ciptool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/ciptool.c') diff --git a/tools/ciptool.c b/tools/ciptool.c index d0b6625d..7c952cf4 100644 --- a/tools/ciptool.c +++ b/tools/ciptool.c @@ -146,9 +146,9 @@ static int do_connect(int ctl, int dev_id, bdaddr_t *src, bdaddr_t *dst, unsigne exit(1); } + memset(&addr, 0, sizeof(addr)); addr.l2_family = AF_BLUETOOTH; bacpy(&addr.l2_bdaddr, src); - addr.l2_psm = 0; if (bind(sk, (struct sockaddr *)&addr, sizeof(addr)) < 0) { perror("Can't bind L2CAP socket"); @@ -156,7 +156,9 @@ static int do_connect(int ctl, int dev_id, bdaddr_t *src, bdaddr_t *dst, unsigne exit(1); } + memset(&opts, 0, sizeof(opts)); size = sizeof(opts); + if (getsockopt(sk, SOL_L2CAP, L2CAP_OPTIONS, &opts, &size) < 0) { perror("Can't get L2CAP options"); close(sk); @@ -173,6 +175,7 @@ static int do_connect(int ctl, int dev_id, bdaddr_t *src, bdaddr_t *dst, unsigne exit(1); } + memset(&addr, 0, sizeof(addr)); addr.l2_family = AF_BLUETOOTH; bacpy(&addr.l2_bdaddr, dst); addr.l2_psm = htobs(psm); -- cgit