diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-12-20 15:51:49 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-12-23 11:45:31 -0800 |
commit | 2be2b945e23ea9740aef79d1e719ce793413e129 (patch) | |
tree | 08c77aca2541c256f72b2e95f068e264de5c6615 /profiles | |
parent | 4839b1135d68adca9d58a0226734cac4a9793071 (diff) | |
download | bluez-2be2b945e23ea9740aef79d1e719ce793413e129.tar.gz |
build: Fix build when sanitizer are enabled
This fixes various issues found when sanitizers are enabled.
Diffstat (limited to 'profiles')
-rw-r--r-- | profiles/audio/a2dp.c | 5 | ||||
-rw-r--r-- | profiles/audio/avctp.c | 2 | ||||
-rw-r--r-- | profiles/network/bnep.c | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c index eba2f9822..d0808c77a 100644 --- a/profiles/audio/a2dp.c +++ b/profiles/audio/a2dp.c @@ -1338,9 +1338,12 @@ static gboolean a2dp_reconfigure(gpointer data) if (setup->rsep) { cap = avdtp_get_codec(setup->rsep->sep); rsep_codec = (struct avdtp_media_codec_capability *) cap->data; + /* Check that codec really match after closing */ + if (sep->codec != rsep_codec->media_codec_type) + setup->rsep = NULL; } - if (!setup->rsep || sep->codec != rsep_codec->media_codec_type) + if (!setup->rsep) setup->rsep = find_remote_sep(setup->chan, sep); if (!setup->rsep) { diff --git a/profiles/audio/avctp.c b/profiles/audio/avctp.c index 9113b5ddc..64d1a8504 100644 --- a/profiles/audio/avctp.c +++ b/profiles/audio/avctp.c @@ -1177,7 +1177,7 @@ static int uinput_create(struct btd_device *device, const char *name, memset(&dev, 0, sizeof(dev)); if (name) { - strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE); + strncpy(dev.name, name, UINPUT_MAX_NAME_SIZE - 1); dev.name[UINPUT_MAX_NAME_SIZE - 1] = '\0'; } diff --git a/profiles/network/bnep.c b/profiles/network/bnep.c index f94f1da8a..54b950058 100644 --- a/profiles/network/bnep.c +++ b/profiles/network/bnep.c @@ -108,7 +108,7 @@ static int bnep_connadd(int sk, uint16_t role, char *dev) struct bnep_connadd_req req; memset(&req, 0, sizeof(req)); - strncpy(req.device, dev, 16); + strncpy(req.device, dev, 15); req.device[15] = '\0'; req.sock = sk; @@ -345,7 +345,7 @@ struct bnep *bnep_new(int sk, uint16_t local_role, uint16_t remote_role, session->io = g_io_channel_unix_new(dup_fd); session->src = local_role; session->dst = remote_role; - strncpy(session->iface, iface, 16); + strncpy(session->iface, iface, 15); session->iface[15] = '\0'; g_io_channel_set_close_on_unref(session->io, TRUE); |