diff options
author | wm4 <wm4@nowhere> | 2013-09-24 21:19:33 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-09-24 21:26:05 +0200 |
commit | fdd5140f43cc5f96f1eca32fabb5beeb92ea1db2 (patch) | |
tree | 9a1fe1118b8c4e8d5b815f7daf49fa490cece33d | |
parent | d75cfef49c271e43317666451f17c55e6747e564 (diff) | |
download | mpv-fdd5140f43cc5f96f1eca32fabb5beeb92ea1db2.tar.bz2 mpv-fdd5140f43cc5f96f1eca32fabb5beeb92ea1db2.tar.xz |
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.
-rw-r--r-- | mpvcore/command.c | 10 |
1 files 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)); |