Browse Source

Fix VST strncpy

Closes #82

Signed-off-by: falkTX <falktx@gmail.com>
pull/83/head
falkTX 5 years ago
parent
commit
3a25a66963
Signed by: falkTX <falktx@gmail.com> GPG Key ID: 2D3445A829213837
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      distrho/src/DistrhoPluginVST.cpp

+ 2
- 1
distrho/src/DistrhoPluginVST.cpp View File

@@ -72,7 +72,8 @@ static const writeMidiFunc writeMidiCallback = nullptr;
void strncpy(char* const dst, const char* const src, const size_t size)
{
DISTRHO_SAFE_ASSERT_RETURN(size > 0,);
std::memcpy(dst, src, std::min(std::strlen(src), size-1));
if (const size_t len = std::strlen(src))
std::memcpy(dst, src, std::min(len, size)-1);
dst[size-1] = '\0';
}



Loading…
Cancel
Save