From b8c3c64af376c41d708ac59e4781e8525f88bc7d Mon Sep 17 00:00:00 2001 From: Iain Hibbert Date: Thu, 14 Apr 2011 10:08:36 +0100 Subject: [PATCH] hcidump: use correct size to copy 'direction' value frm.in is stored as an uint8_t, so we cannot copy an int there directly. use an intermediate variable so that it also works on big-endian systems. --- tools/hcidump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/hcidump.c b/tools/hcidump.c index 14816b5b9..1b80baead 100644 --- a/tools/hcidump.c +++ b/tools/hcidump.c @@ -281,9 +281,11 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags) cmsg = CMSG_FIRSTHDR(&msg); while (cmsg) { + int dir; switch (cmsg->cmsg_type) { case HCI_CMSG_DIR: - memcpy(&frm.in, CMSG_DATA(cmsg), sizeof(int)); + memcpy(&dir, CMSG_DATA(cmsg), sizeof(int)); + frm.in = (uint8_t) dir; break; case HCI_CMSG_TSTAMP: memcpy(&frm.ts, CMSG_DATA(cmsg), -- 2.47.3