Merge "Bluetooth: Check the number of file descriptors" into oc-dr1-dev

am: 269d9ba09a

Change-Id: I1260d97229e5330481178c8f802e2c7f6b651582
This commit is contained in:
Myles Watson 2017-08-10 03:10:57 +00:00 committed by android-build-merger
commit c2cf173510

View file

@ -226,6 +226,11 @@ bool VendorInterface::Open(InitializeCompleteCallback initialize_complete_cb,
int fd_list[CH_MAX] = {0}; int fd_list[CH_MAX] = {0};
int fd_count = lib_interface_->op(BT_VND_OP_USERIAL_OPEN, &fd_list); int fd_count = lib_interface_->op(BT_VND_OP_USERIAL_OPEN, &fd_list);
if (fd_count < 1 || fd_count > CH_MAX - 1) {
ALOGE("%s: fd_count %d is invalid!", __func__, fd_count);
return false;
}
for (int i = 0; i < fd_count; i++) { for (int i = 0; i < fd_count; i++) {
if (fd_list[i] == INVALID_FD) { if (fd_list[i] == INVALID_FD) {
ALOGE("%s: fd %d is invalid!", __func__, fd_list[i]); ALOGE("%s: fd %d is invalid!", __func__, fd_list[i]);