0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

client API: fix log buffer overflow case

It just crashed. The prefix and text fields point to static strings in
this case. Oops.

Fixes the issue mentioned in #838.
This commit is contained in:
wm4 2015-01-13 19:32:53 +01:00
parent 53a5923ba1
commit 9418f88475

View File

@ -751,13 +751,13 @@ mpv_event *mpv_wait_event(mpv_handle *ctx, double timeout)
event->event_id = MPV_EVENT_LOG_MESSAGE;
struct mpv_event_log_message *cmsg = talloc_ptrtype(event, cmsg);
*cmsg = (struct mpv_event_log_message){
.prefix = talloc_steal(event, msg->prefix),
.prefix = msg->prefix,
.level = mp_log_levels[msg->level],
.log_level = mp_mpv_log_levels[msg->level],
.text = talloc_steal(event, msg->text),
.text = msg->text,
};
talloc_steal(event, msg);
event->data = cmsg;
talloc_free(msg);
break;
}
}