Fix osd_show_msg alignment and make sure msg strings

get properly 0 terminated. Thanks to Jonas Jermann
(jjermann _At_ gmx _Dot_ net) for the report.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17930 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
albeu 2006-03-23 15:17:23 +00:00
parent efb50daf6e
commit 8b5c1be40d
1 changed files with 4 additions and 2 deletions

View File

@ -1091,6 +1091,7 @@ static mp_osd_msg_t* osd_msg_stack = NULL;
static void set_osd_msg(int id, int level, int time, char* fmt, ...) {
mp_osd_msg_t *msg,*last=NULL;
va_list va;
int r;
// look if the id is already in the stack
for(msg = osd_msg_stack ; msg && msg->id != id ;
@ -1107,8 +1108,9 @@ static void set_osd_msg(int id, int level, int time, char* fmt, ...) {
}
// write the msg
va_start(va,fmt);
vsnprintf(msg->msg, 63, fmt, va);
r = vsnprintf(msg->msg, 64, fmt, va);
va_end(va);
if(r >= 64) msg->msg[63] = 0;
// set id and time
msg->id = id;
msg->level = level;
@ -3881,7 +3883,7 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
rm_osd_msg(OSD_MSG_OSD_STATUS);
} break;
case MP_CMD_OSD_SHOW_TEXT : {
set_osd_msg(OSD_MSG_TEXT,1,osd_duration,"%64s",cmd->args[0].v.s);
set_osd_msg(OSD_MSG_TEXT,1,osd_duration,"%-.63s",cmd->args[0].v.s);
} break;
case MP_CMD_LOADFILE : {
play_tree_t* e = play_tree_new();