mirror of
https://github.com/mpv-player/mpv
synced 2025-02-17 21:27:08 +00:00
mp_msg.c: Avoid out-of-bounds read if empty string is printed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31626 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
61ed4c2945
commit
63b69b312c
4
mp_msg.c
4
mp_msg.c
@ -234,7 +234,9 @@ void mp_msg_va(int mod, int lev, const char *format, va_list va)
|
||||
if (header)
|
||||
print_msg_module(stream, mod);
|
||||
set_msg_color(stream, lev);
|
||||
header = tmp[strlen(tmp)-1] == '\n' || tmp[strlen(tmp)-1] == '\r';
|
||||
|
||||
size_t len = strlen(tmp);
|
||||
header = len && (tmp[len-1] == '\n' || tmp[len-1] == '\r');
|
||||
|
||||
fprintf(stream, "%s", tmp);
|
||||
if (mp_msg_color)
|
||||
|
Loading…
Reference in New Issue
Block a user