commit ba1ec818e8f88b912fe740268eb03c40a3afa551
parent 87df8f00671e1f5bc717f9b2be26ba76f190ae72
Author: Christopher Arndt <chris@chrisarndt.de>
Date: Wed, 22 Aug 2018 23:50:07 +0200
Avoid gcc >= 8 warning about possible string truncation when using std::strncpy
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/distrho/src/DistrhoPluginVST.cpp b/distrho/src/DistrhoPluginVST.cpp
@@ -71,7 +71,7 @@ static const writeMidiFunc writeMidiCallback = nullptr;
void strncpy(char* const dst, const char* const src, const size_t size)
{
- std::strncpy(dst, src, size-1);
+ std::memcpy(dst, src, std::min(std::strlen(src), size-1));
dst[size-1] = '\0';
}