From: Marcel Holtmann <marcel@holtmann.org>
To: Volker Fritzsch <kokor.hekkus@gmx.de>
Cc: BlueZ Mailing List <bluez-users@lists.sourceforge.net>
Subject: Re: [Bluez-users] pairing on x86_64
Date: Sun, 22 Feb 2004 03:15:51 +0100 [thread overview]
Message-ID: <1077416151.2716.29.camel@pegasus> (raw)
In-Reply-To: <200402212100.12603.kokor.hekkus@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
Hi Volker,
> 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.
and here is the patch I am going to apply. Please test it.
Regards
Marcel
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1206 bytes --]
Index: hcid/main.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/main.c,v
retrieving revision 1.11
diff -u -r1.11 main.c
--- hcid/main.c 17 Feb 2004 18:04:03 -0000 1.11
+++ hcid/main.c 22 Feb 2004 02:09:29 -0000
@@ -397,10 +397,11 @@
gboolean io_stack_event(GIOChannel *chan, GIOCondition cond, gpointer data)
{
- char buf[HCI_MAX_FRAME_SIZE], *ptr;
+ unsigned char buf[HCI_MAX_FRAME_SIZE], *ptr;
evt_stack_internal *si;
hci_event_hdr *eh;
- int len, type;
+ int type;
+ size_t len;
GIOError err;
ptr = buf;
Index: hcid/security.c
===================================================================
RCS file: /cvsroot/bluez/utils/hcid/security.c,v
retrieving revision 1.9
diff -u -r1.9 security.c
--- hcid/security.c 17 Feb 2004 18:04:03 -0000 1.9
+++ hcid/security.c 22 Feb 2004 02:09:29 -0000
@@ -365,9 +365,10 @@
gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data)
{
- char buf[HCI_MAX_EVENT_SIZE], *ptr = buf;
+ unsigned 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-22 2:15 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
2004-02-22 2:15 ` Marcel Holtmann [this message]
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=1077416151.2716.29.camel@pegasus \
--to=marcel@holtmann.org \
--cc=bluez-users@lists.sourceforge.net \
--cc=kokor.hekkus@gmx.de \
/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