1
0
mirror of https://github.com/mpv-player/mpv synced 2025-04-01 23:00:41 +00:00

command: fix short buffer when handling of long property names

This wasn't enough and could lead to a cut off message shown on OSD.
Just make it dynamic, since we already use dynamic memory allocation
at this point anyway.
This commit is contained in:
wm4 2013-09-24 21:19:33 +02:00
parent d75cfef49c
commit fdd5140f43

View File

@ -2050,11 +2050,10 @@ static void show_property_osd(MPContext *mpctx, const char *pname,
return; return;
} }
char buf[40] = {0}; void *tmp = talloc_new(NULL);
if (!msg && osd_name) {
snprintf(buf, sizeof(buf), "%s: ${%s}", osd_name, prop.name); if (!msg && osd_name)
msg = buf; msg = talloc_asprintf(tmp, "%s: ${%s}", osd_name, prop.name);
}
if (osd_progbar && (prop.flags & CONF_RANGE) == CONF_RANGE) { if (osd_progbar && (prop.flags & CONF_RANGE) == CONF_RANGE) {
bool ok = false; bool ok = false;
@ -2073,7 +2072,6 @@ static void show_property_osd(MPContext *mpctx, const char *pname,
msg = NULL; msg = NULL;
} }
void *tmp = talloc_new(NULL);
char *osd_msg = NULL; char *osd_msg = NULL;
if (msg) if (msg)
osd_msg = talloc_steal(tmp, mp_property_expand_string(mpctx, msg)); osd_msg = talloc_steal(tmp, mp_property_expand_string(mpctx, msg));