From: Volker Fritzsch <kokor.hekkus@gmx.de>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: BlueZ Mailing List <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] pairing on x86_64
Date: Sat, 21 Feb 2004 21:00:12 +0100 [thread overview]
Message-ID: <200402212100.12603.kokor.hekkus@gmx.de> (raw)
In-Reply-To: <1077379873.2716.18.camel@pegasus>
[-- Attachment #1: Type: text/plain, Size: 2184 bytes --]
Hi Marcel.
> what is the sizeof(unsigned char) and sizeof(char) on x86_64?
printf says 1 (for both).
> > Feb 21 16:13:57 dionysos hcid[5088]: ** io_security_event
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[0]: 4
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[1]: 22
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[2]: 6
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[3]: 121
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[4]: -109
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[5]: 50
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[6]: -32
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[7]: 7
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf[8]: 0
> > Feb 21 16:13:57 dionysos hcid[5088]: glib-ectomy * buf points to:
> > -1073745232 Feb 21 16:13:57 dionysos hcid[5088]: security * buf[0] = 0
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[1] = 0
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[2] = 0
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[3] = 0
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[4] = -109
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[5] = 50
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[6] = -32
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[7] = 7
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf[8] = 0
> > Feb 21 16:13:57 dionysos hcid[5088]: security * buf points to -1073745232
> > Feb 21 16:13:57 dionysos hcid[5088]: ** type not HCI_EVENT_PKT
>
> I don't know why this happens.
I couldn't understand too, but with your sizeof(char) question you made me
curious.
On x86_64, int has a size of 4 and size_t takes 8 (while on x86 both have a
size of 4).
By passing &len to g_io_channel_read (which takes a size_t *buffer_read as
argument), we blank out the first four bytes of buf - which sits directly
after len in memory ('oh wonderful world...').
> This can be a problem that the call of the PIN helper program fails.
This problem is also solved with the change from int len to size_t len.
So, please trash my first patch and take this instead.
Regards
Volker
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 338 bytes --]
--- ../orig/bluez-utils-2.4/hcid/security.c 2003-07-24 19:34:34.000000000 +0200
+++ hcid/security.c 2004-02-21 20:47:35.000000000 +0100
@@ -356,7 +356,8 @@
{
char buf[HCI_MAX_EVENT_SIZE], *ptr = buf;
struct hci_dev_info *di = (void *) data;
- int len, type, dev;
+ int type, dev;
+ size_t len;
hci_event_hdr *eh;
GIOError err;
next prev parent reply other threads:[~2004-02-21 20:00 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-21 11:52 [Bluez-users] pairing on x86_64 Volker Fritzsch
2004-02-21 12:09 ` Marcel Holtmann
2004-02-21 13:34 ` Volker
2004-02-21 13:56 ` Marcel Holtmann
2004-02-21 14:08 ` Volker Fritzsch
2004-02-21 14:18 ` Marcel Holtmann
2004-02-21 15:48 ` Volker Fritzsch
2004-02-21 16:11 ` Marcel Holtmann
2004-02-21 20:00 ` Volker Fritzsch [this message]
2004-02-22 2:15 ` Marcel Holtmann
2004-02-22 13:24 ` Volker Fritzsch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200402212100.12603.kokor.hekkus@gmx.de \
--to=kokor.hekkus@gmx.de \
--cc=bluez-users@lists.sourceforge.net \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox