Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 5eadc0b

Browse files
authored
Ensure null terminator at the end of a char array. (#663)
1 parent da3f044 commit 5eadc0b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

talk/owt/sdk/base/customizedaudiocapturer.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ int32_t CustomizedAudioCapturer::RecordingDeviceName(
6060
memset(name, 0, kAdmMaxDeviceNameSize);
6161
memset(guid, 0, kAdmMaxGuidSize);
6262
memcpy(name, kName, strlen(kName));
63-
memcpy(guid, kGuid, strlen(guid));
63+
memcpy(guid, kGuid, strlen(kGuid));
64+
name[kAdmMaxDeviceNameSize - 1] = '\0';
65+
guid[kAdmMaxGuidSize - 1] = '\0';
6466
return 0;
6567
}
6668
return -1;

0 commit comments

Comments
 (0)