aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIain Hibbert <plunky@rya-online.net>2011-04-14 10:08:36 +0100
committerJohan Hedberg <johan.hedberg@nokia.com>2011-04-14 20:14:10 +0300
commit4d72d341a6e88fbbaedfa66d4f786f8304d46bbd (patch)
tree026d1efeb042ae5c5a02ce232fb3d5e26a320e37
parentc87badf8aee10917f4c5f8b6128129809a38ace2 (diff)
downloadbluez-hcidump-4d72d341a6e88fbbaedfa66d4f786f8304d46bbd.tar.gz
bluez-hcidump-4d72d341a6e88fbbaedfa66d4f786f8304d46bbd.tar.xz
bluez-hcidump-4d72d341a6e88fbbaedfa66d4f786f8304d46bbd.zip
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.
-rw-r--r--src/hcidump.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hcidump.c b/src/hcidump.c
index 2023130..f865ad6 100644
--- a/src/hcidump.c
+++ b/src/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),