All of lore.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@codecoup.pl>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@codecoup.pl>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 2/3] tools/btpclient: Add connect, disconnect commands
Date: Wed, 10 Jan 2018 14:14:21 +0100	[thread overview]
Message-ID: <1937636.eWU8Ucivx0@ix> (raw)
In-Reply-To: <20180110122527.GA30141@x1c.lan>

Hi Johan,

On Wednesday, 10 January 2018 13:25:27 CET Johan Hedberg wrote:
> Hi Szymon,
> 
> On Wed, Jan 10, 2018, Szymon Janc wrote:
> > On Wednesday, 10 January 2018 12:24:56 CET Johan Hedberg wrote:
> > > On Wed, Jan 10, 2018, Szymon Janc wrote:
> > > > On Tuesday, 9 January 2018 16:45:20 CET Grzegorz Kolodziejczyk wrote:
> > > > > +static bool addr2str(const uint8_t *addr, char *str)
> > > > > +{
> > > > > +	return sprintf(str, "%02hhX:%02hhX:%02hhX:%02hhX:%02hhX:%02hhX",
> > > > > +			addr[0], addr[1], addr[2], addr[3], addr[4], addr[5])
> > > > > +			== 17;
> > > > > +}
> > > > 
> > > > Use snprintf.
> > > 
> > > Why isn't this tool using the address conversion helpers from
> > > lib/bluetooth.c?
> > 
> > This is BTP address and has different byte order.
> 
> Hmm... I'm a bit confused now. I thought BTP is little endian like HCI
> and most Bluetooth protocols. At least that's what it says here:
> 
> https://github.com/zephyrproject-rtos/zephyr/blob/master/tests/bluetooth/tes
> ter/btp_spec.txt#L58
> 
> What am I missing? :)

Yes, you're correct. This needs fixing, although we would have to link against 
libbluetooth only for those sprintf wrappers.. (especially that those use 
insecure variant of printf).

-- 
pozdrawiam
Szymon Janc



  reply	other threads:[~2018-01-10 13:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 15:45 [PATCH BlueZ 1/3] tools/btpclient: Add start, stop advertising commands Grzegorz Kolodziejczyk
2018-01-09 15:45 ` [PATCH BlueZ 2/3] tools/btpclient: Add connect, disconnect commands Grzegorz Kolodziejczyk
2018-01-10 10:57   ` Szymon Janc
2018-01-10 11:24     ` Johan Hedberg
2018-01-10 12:11       ` Szymon Janc
2018-01-10 12:25         ` Johan Hedberg
2018-01-10 13:14           ` Szymon Janc [this message]
2018-01-09 15:45 ` [PATCH BlueZ 3/3] tools/btpclient: Add connected, disconnected event Grzegorz Kolodziejczyk
2018-01-10 10:47 ` [PATCH BlueZ 1/3] tools/btpclient: Add start, stop advertising commands Szymon Janc
2018-01-10 11:36   ` Grzegorz Kołodziejczyk

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=1937636.eWU8Ucivx0@ix \
    --to=szymon.janc@codecoup.pl \
    --cc=grzegorz.kolodziejczyk@codecoup.pl \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.