From fdd5140f43cc5f96f1eca32fabb5beeb92ea1db2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 24 Sep 2013 21:19:33 +0200 Subject: 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. --- mpvcore/command.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mpvcore/command.c b/mpvcore/command.c index 413ca9d1e5..b451669f12 100644 --- a/mpvcore/command.c +++ b/mpvcore/command.c @@ -2050,11 +2050,10 @@ static void show_property_osd(MPContext *mpctx, const char *pname, return; } - char buf[40] = {0}; - if (!msg && osd_name) { - snprintf(buf, sizeof(buf), "%s: ${%s}", osd_name, prop.name); - msg = buf; - } + void *tmp = talloc_new(NULL); + + if (!msg && osd_name) + msg = talloc_asprintf(tmp, "%s: ${%s}", osd_name, prop.name); if (osd_progbar && (prop.flags & CONF_RANGE) == CONF_RANGE) { bool ok = false; @@ -2073,7 +2072,6 @@ static void show_property_osd(MPContext *mpctx, const char *pname, msg = NULL; } - void *tmp = talloc_new(NULL); char *osd_msg = NULL; if (msg) osd_msg = talloc_steal(tmp, mp_property_expand_string(mpctx, msg)); -- cgit v1.2.3