summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bluetooth
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-09-02 17:24:16 +0000
committerdim <dim@FreeBSD.org>2016-09-02 17:24:16 +0000
commitac7fe6d68fbb4c1cd358cfc5e23ed527de34a2f9 (patch)
treeb6f9a73e8366d0722baa1566f2b9c781c7029590 /usr.sbin/bluetooth
parent56c4f0ba32fdf18c536f8fdcbdb18004314ec633 (diff)
downloadFreeBSD-src-ac7fe6d68fbb4c1cd358cfc5e23ed527de34a2f9.zip
FreeBSD-src-ac7fe6d68fbb4c1cd358cfc5e23ed527de34a2f9.tar.gz
MFC r305023:
Avoid undefined behavior when calling va_start() in bnep_send_control(), by making the 'type' parameter a plain unsigned.
Diffstat (limited to 'usr.sbin/bluetooth')
-rw-r--r--usr.sbin/bluetooth/btpand/bnep.c4
-rw-r--r--usr.sbin/bluetooth/btpand/btpand.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/bluetooth/btpand/bnep.c b/usr.sbin/bluetooth/btpand/bnep.c
index 200a723..82116a6 100644
--- a/usr.sbin/bluetooth/btpand/bnep.c
+++ b/usr.sbin/bluetooth/btpand/bnep.c
@@ -573,7 +573,7 @@ bnep_recv_filter_multi_addr_rsp(channel_t *chan, uint8_t *ptr, size_t size)
}
void
-bnep_send_control(channel_t *chan, uint8_t type, ...)
+bnep_send_control(channel_t *chan, unsigned type, ...)
{
packet_t *pkt;
uint8_t *p;
@@ -589,7 +589,7 @@ bnep_send_control(channel_t *chan, uint8_t type, ...)
va_start(ap, type);
*p++ = BNEP_CONTROL;
- *p++ = type;
+ *p++ = (uint8_t)type;
switch(type) {
case BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD:
diff --git a/usr.sbin/bluetooth/btpand/btpand.h b/usr.sbin/bluetooth/btpand/btpand.h
index c5f7204..3bcd1f7 100644
--- a/usr.sbin/bluetooth/btpand/btpand.h
+++ b/usr.sbin/bluetooth/btpand/btpand.h
@@ -183,7 +183,7 @@ b2eaddr(void *dst, bdaddr_t *src)
/* bnep.c */
bool bnep_send(channel_t *, packet_t *);
bool bnep_recv(packet_t *);
-void bnep_send_control(channel_t *, uint8_t, ...);
+void bnep_send_control(channel_t *, unsigned, ...);
/* channel.c */
void channel_init(void);
OpenPOWER on IntegriCloud