From 16ac10d9f75cde959f00df062f544c49941882da Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Wed, 28 Feb 2024 21:08:16 +0100 Subject: [PATCH] PipeWire camera: use length of device id instead display name We want to copy device id to _lastUsedDeviceName variable, but we use length of display name instead of length of device id, which might be longer than expected and we end up reading beyond the source string. Bug: webrtc:15853 Change-Id: Id278ed7e361ead85475910adec18b9db51e6890b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341521 Commit-Queue: Jan Grulich Reviewed-by: Ilya Nikolaevskiy Cr-Commit-Position: refs/heads/main@{#41844} --- modules/video_capture/linux/device_info_pipewire.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/video_capture/linux/device_info_pipewire.cc b/modules/video_capture/linux/device_info_pipewire.cc index e9f7e6a869..b608648194 100644 --- a/modules/video_capture/linux/device_info_pipewire.cc +++ b/modules/video_capture/linux/device_info_pipewire.cc @@ -94,7 +94,7 @@ int32_t DeviceInfoPipeWire::CreateCapabilityMap( continue; _captureCapabilities = node.capabilities(); - _lastUsedDeviceNameLength = node.display_name().length(); + _lastUsedDeviceNameLength = node.unique_id().length(); _lastUsedDeviceName = static_cast( realloc(_lastUsedDeviceName, _lastUsedDeviceNameLength + 1)); memcpy(_lastUsedDeviceName, deviceUniqueIdUTF8,