1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 16:33:02 +00:00

m_property: avoid using a small stack buffer in m_property_do_bstr

This allows operations on properties with longer names (e.g. deeply-nested user-data sub-props).
This commit is contained in:
rcombs 2023-02-12 16:28:16 -06:00
parent 2d4a243810
commit 2e0bdbfe9c

View File

@ -239,11 +239,10 @@ static void m_property_unkey(int *action, void **arg)
static int m_property_do_bstr(const struct m_property *prop_list, bstr name,
int action, void *arg, void *ctx)
{
char name0[64];
if (name.len >= sizeof(name0))
return M_PROPERTY_UNKNOWN;
snprintf(name0, sizeof(name0), "%.*s", BSTR_P(name));
return m_property_do(NULL, prop_list, name0, action, arg, ctx);
char *name0 = bstrdup0(NULL, name);
int ret = m_property_do(NULL, prop_list, name0, action, arg, ctx);
talloc_free(name0);
return ret;
}
static void append_str(char **s, int *len, bstr append)