aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2020-11-10 15:46:26 +0000
committerPaul Adenot <[email protected]>2020-11-16 09:19:25 +0000
commitdf5fe422b77a58fd8f7e0b3953e83807ae04c060 (patch)
treeee2ae95d8147bd334e1f0a4297135502a374210e
parentb887693072f78dd7f39b2354e7443fc38e9fcf54 (diff)
downloadcubeb-df5fe422b77a58fd8f7e0b3953e83807ae04c060.tar.gz
cubeb-df5fe422b77a58fd8f7e0b3953e83807ae04c060.zip
Check various lengths before comparing the group id with the handsfree tag
-rw-r--r--src/cubeb_wasapi.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cubeb_wasapi.cpp b/src/cubeb_wasapi.cpp
index ae06097..5aea0a5 100644
--- a/src/cubeb_wasapi.cpp
+++ b/src/cubeb_wasapi.cpp
@@ -2087,7 +2087,9 @@ int setup_wasapi_stream_one_side(cubeb_stream * stm,
if (rv == CUBEB_OK) {
const char* HANDSFREE_TAG = "BTHHFENUM";
size_t len = sizeof(HANDSFREE_TAG);
- if (direction == eCapture && strncmp(device_info.group_id, HANDSFREE_TAG, len) == 0) {
+ if (direction == eCapture &&
+ strlen(device_info.group_id) >= len &&
+ strncmp(device_info.group_id, HANDSFREE_TAG, len) == 0) {
// Rather high-latency to prevent constant under-runs in this particular
// case of an input device using bluetooth handsfree.
uint32_t default_period_frames = hns_to_frames(device_info.default_rate, default_period);