From: Lars Op den Kamp Date: Fri, 8 Mar 2013 12:45:03 +0000 (+0100) Subject: LibCecSharp: fixed 14 char long OSD name (wasn't \0 terminated) X-Git-Tag: upstream/2.2.0~1^2~5^2~3 X-Git-Url: https://git.piment-noir.org/?p=deb_libcec.git;a=commitdiff_plain;h=cf845048f1e3eabec1b4092126660288eef71ed3 LibCecSharp: fixed 14 char long OSD name (wasn't \0 terminated) --- diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index 889bd47..0bae3ea 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -474,7 +474,11 @@ namespace CecSharp String ^ GetDeviceOSDName(CecLogicalAddress logicalAddress) { cec_osd_name osd = m_libCec->GetDeviceOSDName((cec_logical_address) logicalAddress); - return gcnew String(osd.name); + // we need to terminate with \0, and we only got 14 chars in osd.name + char strOsdName[15]; + memset(strOsdName, 0, sizeof(strOsdName)); + memcpy(strOsdName, osd.name, sizeof(osd.name)); + return gcnew String(strOsdName); } ///