From 036100eecda4a1fa96ac74227bc23fea02074082 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Wed, 17 Feb 2021 22:45:45 +0100 Subject: [PATCH] [cast] Length check of protobuf messages just to be safe --- src/outputs/cast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/outputs/cast.c b/src/outputs/cast.c index e5229ec0..f8d5ec3d 100644 --- a/src/outputs/cast.c +++ b/src/outputs/cast.c @@ -725,7 +725,7 @@ cast_msg_send(struct cast_session *cs, enum cast_msg_types type, cast_reply_cb r msg.payload_utf8 = msg_buf; len = extensions__core_api__cast_channel__cast_message__get_packed_size(&msg); - if (len <= 0) + if (len <= 0 || len >= sizeof(buf) - 4) { DPRINTF(E_LOG, L_CAST, "Could not send message (type %d), invalid length: %zu\n", type, len); return -1;