Date: Mon, 29 Aug 2016 19:40:46 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305023 - head/usr.sbin/bluetooth/btpand Message-ID: <201608291940.u7TJek72077884@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Mon Aug 29 19:40:46 2016 New Revision: 305023 URL: https://svnweb.freebsd.org/changeset/base/305023 Log: Avoid undefined behavior when calling va_start() in bnep_send_control(), by making the 'type' parameter a plain unsigned. MFC after: 3 days Modified: head/usr.sbin/bluetooth/btpand/bnep.c head/usr.sbin/bluetooth/btpand/btpand.h Modified: head/usr.sbin/bluetooth/btpand/bnep.c ============================================================================== --- head/usr.sbin/bluetooth/btpand/bnep.c Mon Aug 29 19:33:07 2016 (r305022) +++ head/usr.sbin/bluetooth/btpand/bnep.c Mon Aug 29 19:40:46 2016 (r305023) @@ -574,7 +574,7 @@ bnep_recv_filter_multi_addr_rsp(channel_ } void -bnep_send_control(channel_t *chan, uint8_t type, ...) +bnep_send_control(channel_t *chan, unsigned type, ...) { packet_t *pkt; uint8_t *p; @@ -590,7 +590,7 @@ bnep_send_control(channel_t *chan, uint8 va_start(ap, type); *p++ = BNEP_CONTROL; - *p++ = type; + *p++ = (uint8_t)type; switch(type) { case BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD: Modified: head/usr.sbin/bluetooth/btpand/btpand.h ============================================================================== --- head/usr.sbin/bluetooth/btpand/btpand.h Mon Aug 29 19:33:07 2016 (r305022) +++ head/usr.sbin/bluetooth/btpand/btpand.h Mon Aug 29 19:40:46 2016 (r305023) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608291940.u7TJek72077884>