|
|
# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../bluez-hcidump/0006-hcidump-use-correct-size-to-copy-direction-value.patch # Copyright (C) 2011 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END ---
From 4c52001490ef09a95d4521967e89a8ce2801fd30 Mon Sep 17 00:00:00 2001 From: Iain Hibbert <plunky@rya-online.net> Date: Thu, 14 Apr 2011 10:08:36 +0100 Subject: [PATCH 6/6] 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. ---
src/hcidump.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/hcidump.c b/src/hcidump.c
index 2f406db..a966ab2 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), --
1.7.2.3
|