diff --git a/libobs/obs-module.c b/libobs/obs-module.c index c2e9563e0..306c42c72 100644 --- a/libobs/obs-module.c +++ b/libobs/obs-module.c @@ -437,6 +437,16 @@ cleanup: return; \ } \ \ + if (size_var > sizeof(data)) { \ + blog(LOG_ERROR, "Tried to register " #structure \ + " with size %llu which is more " \ + "than libobs currently supports " \ + "(%llu)", \ + (long long unsigned)size_var, \ + (long long unsigned)sizeof(data));\ + return; \ + } \ + \ memcpy(&data, info, size_var); \ da_push_back(dest, &data); \ } while (false) @@ -489,6 +499,14 @@ void obs_register_source_s(const struct obs_source_info *info, size_t size) } #undef CHECK_REQUIRED_VAL_ + if (size > sizeof(data)) { + blog(LOG_ERROR, "Tried to register obs_source_info with size " + "%llu which is more than libobs currently " + "supports (%llu)", (long long unsigned)size, + (long long unsigned)sizeof(data)); + return; + } + memcpy(&data, info, size); /* mark audio-only filters as an async filter categorically */