summaryrefslogtreecommitdiffstats
path: root/options/m_property.c
diff options
context:
space:
mode:
authorrcombs <rcombs@rcombs.me>2023-02-12 16:28:16 -0600
committerrcombs <rcombs@rcombs.me>2023-02-13 14:39:41 -0600
commit2e0bdbfe9cb856544ee5af2a9bbf82e1b07e5e06 (patch)
tree56e2e152eee25bee07db6a4e61070dcc39395f6c /options/m_property.c
parent2d4a243810c5e1b540444b74aebe624f56408e25 (diff)
downloadmpv-2e0bdbfe9cb856544ee5af2a9bbf82e1b07e5e06.tar.bz2
mpv-2e0bdbfe9cb856544ee5af2a9bbf82e1b07e5e06.tar.xz
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).
Diffstat (limited to 'options/m_property.c')
-rw-r--r--options/m_property.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/options/m_property.c b/options/m_property.c
index d286f60ad8..a2e9fe7187 100644
--- a/options/m_property.c
+++ b/options/m_property.c
@@ -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)