[MPlayer-cvslog] CVS: main mplayer.c,1.919,1.920

Alban Bedel CVS syncmail at mplayerhq.hu
Thu Mar 23 16:17:25 CET 2006


CVS change done by Alban Bedel CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv21883

Modified Files:
	mplayer.c 
Log Message:
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.


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.919
retrieving revision 1.920
diff -u -r1.919 -r1.920
--- mplayer.c	23 Mar 2006 01:22:42 -0000	1.919
+++ mplayer.c	23 Mar 2006 15:17:23 -0000	1.920
@@ -1091,6 +1091,7 @@
 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 @@
     }
     // 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 @@
 	  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();




More information about the MPlayer-cvslog mailing list