Fix improper buffer size in call to rtc::strcpyn

rtc::strcpyn second param should be the size of the destination buffer,
not the size of the source string.  The result is that the final character
(usually a trailing directory path separator) is lost during the copy.
This has been masked because FormFileName helpfully adds a trailing path
separator if one is missing.

BUG=webrtc:15441

Change-Id: I992e69cad86a7e8bc2057ec629063f34c75fe75f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/317502
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Björn Terelius <terelius@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40736}
This commit is contained in:
Michael Froman 2023-08-23 13:45:46 -05:00 committed by WebRTC LUCI CQ
parent ffd656694a
commit 90fb11e806

View File

@ -91,7 +91,7 @@ class ApmDataDumper {
static void SetOutputDirectory(absl::string_view output_dir) {
#if WEBRTC_APM_DEBUG_DUMP == 1
RTC_CHECK_LT(output_dir.size(), kOutputDirMaxLength);
rtc::strcpyn(output_dir_, output_dir.size(), output_dir);
rtc::strcpyn(output_dir_, kOutputDirMaxLength, output_dir);
#endif
}