From: Lars Op den Kamp Date: Tue, 8 May 2012 09:15:55 +0000 (+0200) Subject: LibCecSharp: fixed buffer overrun when copying libcec_configuration. fixes crash... X-Git-Tag: upstream/2.2.0~1^2~28^2~29 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1d0b2f179049bb299227a311b2323024622b7826;p=deb_libcec.git LibCecSharp: fixed buffer overrun when copying libcec_configuration. fixes crash when trying to save the configuration in the config gui. --- diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index 680ccfb..fb72323 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -91,7 +91,8 @@ namespace CecSharp { config.Clear(); - _snprintf_s(config.strDeviceName, 13, context->marshal_as(netConfig->DeviceName)); + const char *strDeviceName = context->marshal_as(netConfig->DeviceName); + memcpy_s(config.strDeviceName, 13, strDeviceName, 13); for (unsigned int iPtr = 0; iPtr < 5; iPtr++) config.deviceTypes.types[iPtr] = (cec_device_type)netConfig->DeviceTypes->Types[iPtr]; @@ -128,7 +129,10 @@ namespace CecSharp } if (netConfig->ServerVersion >= CecServerVersion::Version1_6_2) - _snprintf_s(config.strDeviceLanguage, 3, context->marshal_as(netConfig->DeviceLanguage)); + { + const char *strDeviceLanguage = context->marshal_as(netConfig->DeviceLanguage); + memcpy_s(config.strDeviceLanguage, 3, strDeviceLanguage, 3); + } config.callbacks = &g_cecCallbacks; }