Browse Source

VST3: Fix for hosts assuming string size includes null byte

Signed-off-by: falkTX <falktx@falktx.com>
pull/375/head
falkTX 3 years ago
parent
commit
e512b25281
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      distrho/src/DistrhoPluginVST3.cpp
  2. +2
    -2
      distrho/src/DistrhoUIVST3.cpp

+ 2
- 2
distrho/src/DistrhoPluginVST3.cpp View File

@@ -2097,12 +2097,12 @@ public:
int16_t* const value16 = (int16_t*)std::malloc(sizeof(int16_t)*(valueLength + 1));
DISTRHO_SAFE_ASSERT_RETURN(value16 != nullptr, V3_NOMEM);

res = v3_cpp_obj(attrs)->get_string(attrs, "key", key16, sizeof(int16_t)*keyLength);
res = v3_cpp_obj(attrs)->get_string(attrs, "key", key16, sizeof(int16_t)*(keyLength+1));
DISTRHO_SAFE_ASSERT_INT2_RETURN(res == V3_OK, res, keyLength, res);

if (valueLength != 0)
{
res = v3_cpp_obj(attrs)->get_string(attrs, "value", value16, sizeof(int16_t)*valueLength);
res = v3_cpp_obj(attrs)->get_string(attrs, "value", value16, sizeof(int16_t)*(valueLength+1));
DISTRHO_SAFE_ASSERT_INT2_RETURN(res == V3_OK, res, valueLength, res);
}



+ 2
- 2
distrho/src/DistrhoUIVST3.cpp View File

@@ -573,12 +573,12 @@ public:
int16_t* const value16 = (int16_t*)std::malloc(sizeof(int16_t)*(valueLength + 1));
DISTRHO_SAFE_ASSERT_RETURN(value16 != nullptr, V3_NOMEM);

res = v3_cpp_obj(attrs)->get_string(attrs, "key", key16, sizeof(int16_t)*keyLength);
res = v3_cpp_obj(attrs)->get_string(attrs, "key", key16, sizeof(int16_t)*(keyLength+1));
DISTRHO_SAFE_ASSERT_INT2_RETURN(res == V3_OK, res, keyLength, res);

if (valueLength != 0)
{
res = v3_cpp_obj(attrs)->get_string(attrs, "value", value16, sizeof(int16_t)*valueLength);
res = v3_cpp_obj(attrs)->get_string(attrs, "value", value16, sizeof(int16_t)*(valueLength+1));
DISTRHO_SAFE_ASSERT_INT2_RETURN(res == V3_OK, res, valueLength, res);
}



Loading…
Cancel
Save