laptou / bluez-rs

Control Bluetooth on Linux.
MIT License
39 stars 9 forks source link

Fix `set_local_name` panic due to incorrect buffer size #2

Closed timvisee closed 4 years ago

timvisee commented 4 years ago

The copy_to_slice function is used to copy the device name into a data buffer.

The cursor is advanced by the number of bytes copied. self must have enough remaining bytes to fill dst.

According to it's documentation the destination buffer may not be bigger than the source. Therefore I made the destination buffer the same size as the source instead of the maximum size to fix the panic I encountered in #1.

Fixes https://github.com/laptou/bluez-rs/issues/1